List of usage examples for javax.websocket WebSocketContainer setAsyncSendTimeout
void setAsyncSendTimeout(long timeout);
From source file:co.paralleluniverse.comsat.webactors.AbstractWebActorTest.java
@Test public void testWebSocketMsg() throws IOException, InterruptedException, ExecutionException, DeploymentException { BasicCookieStore cookieStore = new BasicCookieStore(); final HttpGet httpGet = new HttpGet("http://localhost:8080"); HttpClients.custom().setDefaultRequestConfig(requestConfig).setDefaultCookieStore(cookieStore).build() .execute(httpGet, new BasicResponseHandler()); final SettableFuture<String> res = new SettableFuture<>(); final WebSocketContainer wsContainer = ContainerProvider.getWebSocketContainer(); wsContainer.setAsyncSendTimeout(timeout); wsContainer.setDefaultMaxSessionIdleTimeout(timeout); try (final Session ignored = wsContainer.connectToServer(sendAndGetTextEndPoint("test it", res), getClientEndPointConfig(cookieStore), URI.create("ws://localhost:8080/ws"))) { final String s = res.get(); assertEquals("test it", s); }//w w w . j a va2 s . com }