Opens a WebSocket connection to the test server. @param path WebSocket path (must start with "/") @param listener listener @return JDK WebSocket client @throws Exception exception
(final String path, final Listener listener)
| 67 | * @throws Exception exception |
| 68 | */ |
| 69 | protected static java.net.http.WebSocket connect(final String path, final Listener listener) |
| 70 | throws Exception { |
| 71 | final HttpClient client = HttpClient.newHttpClient(); |
| 72 | return client.newWebSocketBuilder().connectTimeout(Duration.ofSeconds(10)). |
| 73 | buildAsync(URI.create(WS_ROOT + path), listener).get(10, TimeUnit.SECONDS); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Closes a WebSocket and waits for the close handshake to complete. |
no test coverage detected