Skip to content

Commit 6375610

Browse files
committed
Adapt test to Java 17
1 parent 79769c4 commit 6375610

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

test/jdk/java/net/httpclient/RedirectTimeoutTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,12 @@ public void test(Version version, URI uri, URI redirectURI) throws InterruptedEx
114114
.timeout(Duration.ofMillis(adjustTimeout(TIMEOUT_MILLIS)))
115115
.build();
116116

117-
try (HttpClient client = clientBuilder.build()) {
117+
HttpClient client = clientBuilder.build();
118+
try {
118119
if (version.equals(HTTP_2))
119-
client.send(HttpRequest.newBuilder(h2WarmupUri).HEAD().build(), HttpResponse.BodyHandlers.discarding());
120+
client.send(HttpRequest.newBuilder(h2WarmupUri)
121+
.method("HEAD", HttpRequest.BodyPublishers.noBody()).build(),
122+
HttpResponse.BodyHandlers.discarding());
120123
/*
121124
With TIMEOUT_MILLIS set to 1500ms and the server's RedirectHandler sleeping for 750ms before responding
122125
to each request, 4 iterations will take a guaranteed minimum time of 3000ms which will ensure that any

0 commit comments

Comments
 (0)