@Test(timeOut = 60000, expectedExceptions = ExecutionException.class) public void sendPongMessageExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendPongFrame("PONG".getBytes()).get(1, TimeUnit.SECONDS); } }
@Test(timeOut = 60000) public void sendByteMessage() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendBinaryFrame("BYTES".getBytes()).get(10, TimeUnit.SECONDS); } }
@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 sendByteMessageExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendBinaryFrame("BYTES".getBytes()).get(10, TimeUnit.SECONDS); } }
@Test(timeOut = 60000) public void streamBytes() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendBinaryFrame("STREAM".getBytes(), true, 0).get(1, 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); } }
@Test(timeOut = 60000) public void sendPongMessage() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendPongFrame("PONG".getBytes()).get(10, TimeUnit.SECONDS); } }
@Test(timeOut = 60000, expectedExceptions = ExecutionException.class) public void streamBytesExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendBinaryFrame("STREAM".getBytes(), true, 0).get(1, TimeUnit.SECONDS); } }
@Test(timeOut = 60000, expectedExceptions = ExecutionException.class) public void sendTextMessageExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendTextFrame("TEXT").get(10, TimeUnit.SECONDS); } }
@Test(expectedExceptions = ExecutionException.class) public void streamTextExpectFailure() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { CountDownLatch closeLatch = new CountDownLatch(1); WebSocket websocket = getWebSocket(c, closeLatch); websocket.sendCloseFrame(); closeLatch.await(1, TimeUnit.SECONDS); websocket.sendTextFrame("STREAM", true, 0).get(1, TimeUnit.SECONDS); } }
@Test(timeOut = 60000) public void sendTextMessage() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendTextFrame("TEXT").get(10, TimeUnit.SECONDS); } }
@Test public void streamText() throws Exception { try (AsyncHttpClient c = asyncHttpClient()) { getWebSocket(c).sendTextFrame("STREAM", true, 0).get(1, TimeUnit.SECONDS); } }