SiyaoIsHiding commented on code in PR #1735:
URL: 
https://github.com/apache/cassandra-java-driver/pull/1735#discussion_r1524149783


##########
core/src/test/java/com/datastax/oss/driver/internal/core/metadata/SniEndPointTest.java:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.datastax.oss.driver.internal.core.metadata;
+
+import static com.datastax.oss.driver.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
+import java.util.Arrays;
+import java.util.stream.Stream;
+import org.apache.commons.lang3.ArrayUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SniEndPointTest {
+  private static InetSocketAddress SNI_ADDRESS =
+      InetSocketAddress.createUnresolved("unittest.host", 12345);
+  private static String SERVER_NAME = "unittest.server.name";
+
+  @Spy private SniEndPoint sniEndPoint = new SniEndPoint(SNI_ADDRESS, 
SERVER_NAME);
+
+  private static InetAddress[] createAddresses(String... addrs) {
+    return Stream.of(addrs)
+        .map(
+            addr -> {
+              try {
+                int[] comp = 
Arrays.stream(addr.split("\\.")).mapToInt(Integer::parseInt).toArray();
+                return InetAddress.getByAddress(
+                    new byte[] {(byte) comp[0], (byte) comp[1], (byte) 
comp[2], (byte) comp[3]});

Review Comment:
   Sorry, I am confused. Could you pls explain more?
   `InetAddress.getByAddress` does not do reverse lookup. 
`InetAddress.getByName` will look it up. We don't want it to look up. 
Therefore, I think `InetAddress.getByAddress` is the one we should use. :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to