File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
tests/src/test/java/io/jooby/i2784 Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 55 */
66package io .jooby .i2784 ;
77
8+ import java .time .Duration ;
89import java .util .concurrent .CountDownLatch ;
910
1011import org .asynchttpclient .Dsl ;
@@ -60,16 +61,18 @@ public void onPongFrame(byte[] payload) {
6061 })
6162 .build ();
6263
63- WebSocket webSocketClient =
64- Dsl .asyncHttpClient ()
65- .prepareGet ("ws://localhost:" + http .getPort () + "/2784" )
66- .setRequestTimeout (5000 )
67- .execute (wsHandler )
68- .get ();
69- // Send ping
70- webSocketClient .sendPingFrame ();
64+ try (var client = Dsl .asyncHttpClient ()) {
65+ WebSocket webSocketClient =
66+ client
67+ .prepareGet ("ws://localhost:" + http .getPort () + "/2784" )
68+ .setRequestTimeout (Duration .ofSeconds (5 ))
69+ .execute (wsHandler )
70+ .get ();
71+ // Send ping
72+ webSocketClient .sendPingFrame ();
7173
72- latch .await ();
74+ latch .await ();
75+ }
7376 });
7477 }
7578}
You can’t perform that action at this time.
0 commit comments