test/jdk/java/net/httpclient/HttpsTunnelTest.java
branchhttp-client-branch
changeset 56265 ec34ae013fbe
parent 56167 96fa4f49a9ff
child 56451 9585061fdb04
--- a/test/jdk/java/net/httpclient/HttpsTunnelTest.java	Thu Mar 08 17:41:52 2018 +0000
+++ b/test/jdk/java/net/httpclient/HttpsTunnelTest.java	Thu Mar 08 17:42:16 2018 +0000
@@ -25,6 +25,7 @@
 import com.sun.net.httpserver.HttpsServer;
 import jdk.testlibrary.SimpleSSLContext;
 import javax.net.ssl.SSLContext;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.net.ProxySelector;
 import java.net.URI;
@@ -97,7 +98,7 @@
     }
 
     public static void main(String[] args) throws Exception {
-        InetSocketAddress sa = new InetSocketAddress(0);
+        InetSocketAddress sa = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0);
         HttpsServer server1 = HttpsServer.create(sa, 0);
         server1.setHttpsConfigurator(new HttpsConfigurator(context));
         HttpTestServer http1Server =
@@ -105,7 +106,7 @@
         http1Server.addHandler(new HttpTestEchoHandler(), "/");
         http1Server.start();
         HttpTestServer http2Server = HttpTestServer.of(
-                new Http2TestServer("127.0.0.1", true, 0));
+                new Http2TestServer("localhost", true, 0));
         http2Server.addHandler(new HttpTestEchoHandler(), "/");
         http2Server.start();
 
@@ -113,8 +114,8 @@
                 DigestEchoServer.HttpAuthSchemeType.NONE);
 
         try {
-            URI uri1 = new URI("https:/" + http1Server.getAddress() + "/foo/https1");
-            URI uri2 = new URI("https:/" + http2Server.getAddress() + "/foo/https2");
+            URI uri1 = new URI("https://" + http1Server.serverAuthority() + "/foo/https1");
+            URI uri2 = new URI("https://" + http2Server.serverAuthority() + "/foo/https2");
             ProxySelector ps = ProxySelector.of(proxy.getProxyAddress());
                     //HttpClient.Builder.NO_PROXY;
             HttpsTunnelTest test = new HttpsTunnelTest();