Skip to content

Commit

Permalink
test: fix Http2HeadersTest
Browse files Browse the repository at this point in the history
  • Loading branch information
NiccoMlt committed Dec 10, 2024
1 parent 3129d15 commit 38fa775
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt
.withBody("it <b>works</b> !!"))
);
final var mapper = new TestEndpointMapper("localhost", wireMockRule.port());
final HttpClientResponse response;
try (final var server = new HttpProxyServer(mapper, tmpDir.newFolder())) {
server.addListener(new NetworkListenerConfiguration(
"localhost",
Expand All @@ -72,7 +73,7 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt

server.start();
final var port = server.getLocalPort();
final HttpClientResponse response = HttpClient.create()
response = HttpClient.create()
.protocol(HttpProtocol.H2C, HttpProtocol.HTTP11)
.headers(headers -> headers
.add(HttpHeaderNames.CONNECTION, "keep-alive")
Expand All @@ -83,9 +84,9 @@ public void test() throws IOException, ConfigurationNotValidException, Interrupt
.uri("http://localhost:" + port + "/index.html")
.response()
.block();
assertThat(response, is(notNullValue()));
assertThat(response.status(), is(HttpResponseStatus.OK));
assertThat(response.version(), is(HttpVersion.HTTP_1_1));
}
assertThat(response, is(notNullValue()));
assertThat(response.status(), is(HttpResponseStatus.OK));
assertThat(response.version(), is(HttpVersion.valueOf("HTTP/2.0")));
}
}

0 comments on commit 38fa775

Please sign in to comment.