--- a/test/jdk/java/net/httpclient/InterruptedBlockingSend.java Thu Mar 08 17:41:52 2018 +0000
+++ b/test/jdk/java/net/httpclient/InterruptedBlockingSend.java Thu Mar 08 17:42:16 2018 +0000
@@ -21,6 +21,7 @@
* questions.
*/
+import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.URI;
@@ -43,9 +44,9 @@
HttpClient client = HttpClient.newHttpClient();
try (ServerSocket ss = new ServerSocket()) {
ss.setReuseAddress(false);
- ss.bind(new InetSocketAddress(0));
+ ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
int port = ss.getLocalPort();
- URI uri = new URI("http://127.0.0.1:" + port + "/");
+ URI uri = new URI("http://localhost:" + port + "/");
HttpRequest request = HttpRequest.newBuilder(uri).build();