Skip to content

Commit

Permalink
Fix failing test due to HttpClient being collected during the test
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed May 30, 2024
1 parent d21c6b5 commit d32655c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/test/java/io/vertx/core/http/WebSocketTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2878,8 +2878,9 @@ private void testServerWebSocketHandshakeWithNonPersistentConnection(HttpVersion
ws.close();
});
});
HttpClientAgent client = vertx.createHttpClient(new HttpClientOptions().setProtocolVersion(version).setKeepAlive(false));
server.listen(DEFAULT_HTTP_PORT, DEFAULT_HTTP_HOST).onComplete(onSuccess(v1 -> {
handshake(vertx.createHttpClient(new HttpClientOptions().setProtocolVersion(version).setKeepAlive(false)), req -> {
handshake(client, req -> {
req.send().onComplete(onSuccess(resp -> {
assertEquals(101, resp.statusCode());
resp.endHandler(v -> {
Expand All @@ -2894,9 +2895,9 @@ private void testServerWebSocketHandshakeWithNonPersistentConnection(HttpVersion
pipeline.addBefore("handler", "encoder", new WebSocket13FrameEncoder(true));
pipeline.addBefore("handler", "decoder", new WebSocket13FrameDecoder(false, false, 1000));
pipeline.remove("codec");
soi.writeMessage(new PingWebSocketFrame()).onComplete(onSuccess(written -> {
}));
Future<Void> pingSent = soi.writeMessage(new PingWebSocketFrame());
soi.closeHandler(v2 -> {
assertTrue(pingSent.succeeded());
testComplete();
});
});
Expand Down

0 comments on commit d32655c

Please sign in to comment.