Skip to content

Commit

Permalink
SapMachine #1646: Improvements for test TestConnectionIDFeature.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RealCLanger committed Dec 26, 2024
1 parent c91b009 commit 20b6ad5
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
Expand All @@ -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());
Expand Down

0 comments on commit 20b6ad5

Please sign in to comment.