From 20b6ad50c4094495c23119498916adbc665e1c7a Mon Sep 17 00:00:00 2001 From: Christoph Langer Date: Thu, 26 Dec 2024 19:08:46 +0100 Subject: [PATCH] SapMachine #1646: Improvements for test TestConnectionIDFeature.java --- .../www/http/KeepAliveCache/TestConnectionIDFeature.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/jdk/sun/net/www/http/KeepAliveCache/TestConnectionIDFeature.java b/test/jdk/sun/net/www/http/KeepAliveCache/TestConnectionIDFeature.java index 6edf5097dad..2b52178e9db 100644 --- a/test/jdk/sun/net/www/http/KeepAliveCache/TestConnectionIDFeature.java +++ b/test/jdk/sun/net/www/http/KeepAliveCache/TestConnectionIDFeature.java @@ -123,7 +123,7 @@ public String get() { try { URL url = URIBuilder.newBuilder() .scheme("http") - .host(InetAddress.getLocalHost()) + .host(InetAddress.getLoopbackAddress()) .port(server.getAddress().getPort()) .path("/" + connectionId) .toURL(); @@ -154,7 +154,7 @@ public String get() { try { URL url = URIBuilder.newBuilder() .scheme("http") - .host(InetAddress.getLocalHost()) + .host(InetAddress.getLoopbackAddress()) .port(server.getAddress().getPort()) .path("/" + connectionId) .toURL(); @@ -173,7 +173,7 @@ public String get() { public static void initialize() { // start server try { - server = HttpServer.create(new InetSocketAddress(InetAddress.getLocalHost(), 0), 10, "/", new TestConnectionIDFeature.TestHttpHandler()); + server = HttpServer.create(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), 10, "/", new TestConnectionIDFeature.TestHttpHandler()); } catch (IOException e) { throw new RuntimeException("Could not create server", e); } @@ -200,7 +200,7 @@ public static void runRequests() { // run second batch of requests where we expect that connections be reused clientFutures.clear(); while (connectionIds.peek() != null) { - clientFutures.add(CompletableFuture.supplyAsync(new InitialRequest(connectionIds.pop()), executor)); + clientFutures.add(CompletableFuture.supplyAsync(new SecondRequest(connectionIds.pop()), executor)); } for (var future : clientFutures) { connectionIds.push(future.join());