@Test(timeOut = 60000) public void sendPingMessage() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendPingFrame("PING".getBytes()).get(10, TimeUnit.SECONDS); } }
@Test(timeOut = 60000, expectedExceptions = ExecutionException.class) public void sendPingMessageExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendPingFrame("PING".getBytes()).get(10, TimeUnit.SECONDS); } }