|
1 | 1 | /* |
2 | | - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | 4 | * |
5 | 5 | * This code is free software; you can redistribute it and/or modify it |
|
44 | 44 | import java.net.http.HttpRequest.BodyPublishers; |
45 | 45 | import java.net.http.HttpResponse; |
46 | 46 | import java.net.http.HttpResponse.BodyHandlers; |
| 47 | + |
| 48 | +import jdk.test.lib.net.URIBuilder; |
47 | 49 | import org.testng.annotations.AfterTest; |
48 | 50 | import org.testng.annotations.BeforeTest; |
49 | 51 | import org.testng.annotations.DataProvider; |
50 | | -import static java.lang.String.format; |
51 | 52 | import static java.lang.System.out; |
52 | 53 | import static java.net.http.HttpClient.Builder.NO_PROXY; |
53 | 54 | import static java.net.http.HttpClient.Version.HTTP_1_1; |
|
56 | 57 | import static java.util.concurrent.TimeUnit.NANOSECONDS; |
57 | 58 | import static org.testng.Assert.fail; |
58 | 59 |
|
59 | | -public abstract class AbstractConnectTimeoutHandshake { |
| 60 | +abstract class AbstractConnectTimeoutHandshake { |
60 | 61 |
|
61 | 62 | // The number of iterations each testXXXClient performs. |
62 | 63 | static final int TIMES = 2; |
@@ -197,15 +198,15 @@ static void printResponse(HttpResponse<?> response) { |
197 | 198 |
|
198 | 199 | // -- Infrastructure |
199 | 200 |
|
200 | | - static String serverAuthority(Server server) { |
201 | | - return InetAddress.getLoopbackAddress().getHostName() + ":" |
202 | | - + server.getPort(); |
203 | | - } |
204 | | - |
205 | 201 | @BeforeTest |
206 | 202 | public void setup() throws Exception { |
207 | 203 | server = new Server(); |
208 | | - httpsURI = URI.create("https://" + serverAuthority(server) + "/foo"); |
| 204 | + httpsURI = URIBuilder.newBuilder() |
| 205 | + .scheme("https") |
| 206 | + .loopback() |
| 207 | + .port(server.getPort()) |
| 208 | + .path("/foo") |
| 209 | + .build(); |
209 | 210 | out.println("HTTPS URI: " + httpsURI); |
210 | 211 | } |
211 | 212 |
|
|
0 commit comments