test/jdk/java/net/httpclient/ProxyTest.java
branchhttp-client-branch
changeset 56265 ec34ae013fbe
parent 56167 96fa4f49a9ff
child 56451 9585061fdb04
--- a/test/jdk/java/net/httpclient/ProxyTest.java	Thu Mar 08 17:41:52 2018 +0000
+++ b/test/jdk/java/net/httpclient/ProxyTest.java	Thu Mar 08 17:42:16 2018 +0000
@@ -104,7 +104,8 @@
         });
 
         server.setHttpsConfigurator(new Configurator(SSLContext.getDefault()));
-        server.bind(new InetSocketAddress(0), 0);
+        InetSocketAddress addr = new InetSocketAddress(InetAddress.getLoopbackAddress(), 0);
+        server.bind(addr, 0);
         return server;
     }
 
@@ -242,7 +243,7 @@
         }
 
         void start() throws IOException {
-            ss.bind(new InetSocketAddress(0));
+            ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
             accept.start();
         }
 
@@ -276,9 +277,8 @@
         }
 
         public InetSocketAddress getAddress() {
-            return new InetSocketAddress(
-                    "localhost",
-                    ss.getLocalPort());
+            return new InetSocketAddress(InetAddress.getLoopbackAddress(),
+                                         ss.getLocalPort());
         }
 
         // This is a bit shaky. It doesn't handle continuation