@Test public void testServerWebsocketPongExceeds125Bytes() { testServerWebsocketPingPongCheck(255, ws -> { try { ws.writePong(Buffer.buffer(randomAlphaString(126))); } catch(Throwable expected) { assertEquals("Pong cannot exceed maxWebSocketFrameSize or 125 bytes", expected.getMessage()); ws.close(); testComplete(); } }); }
@Test public void testServerWebsocketPongExceedsMaxFrameSize() { testServerWebsocketPingPongCheck(100, ws -> { try { ws.writePong(Buffer.buffer(randomAlphaString(101))); } catch(Throwable expected) { assertEquals("Pong cannot exceed maxWebSocketFrameSize or 125 bytes", expected.getMessage()); ws.close(); testComplete(); } }); }
@Test public void testServerWebsocketPongExceeds125Bytes() { testServerWebsocketPingPongCheck(255, ws -> { try { ws.writePong(Buffer.buffer(randomAlphaString(126))); } catch(Throwable expected) { assertEquals("Pong cannot exceed maxWebSocketFrameSize or 125 bytes", expected.getMessage()); ws.close(); testComplete(); } }); }
@Test public void testServerWebsocketPongExceedsMaxFrameSize() { testServerWebsocketPingPongCheck(100, ws -> { try { ws.writePong(Buffer.buffer(randomAlphaString(101))); } catch(Throwable expected) { assertEquals("Pong cannot exceed maxWebSocketFrameSize or 125 bytes", expected.getMessage()); ws.close(); testComplete(); } }); }
/** * Writes a pong to the connection. This will be written in a single frame. Pong frames may be at most 125 bytes (octets). * <p> * This method should not be used to write application data and should only be used for implementing a keep alive or * to ensure the client is still responsive, see RFC 6455 Section 5.5.2. * <p> * There is no need to manually write a Pong, as the server and client both handle responding to a ping with a pong * automatically and this is exposed to users.RFC 6455 Section 5.5.3 states that pongs may be sent unsolicited in order * to implement a one way heartbeat. * @param data the data to write, may be at most 125 bytes * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.WebSocketBase writePong(io.vertx.rxjava.core.buffer.Buffer data) { delegate.writePong(data.getDelegate()); return this; }
/** * Writes a pong to the connection. This will be written in a single frame. Pong frames may be at most 125 bytes (octets). * <p> * This method should not be used to write application data and should only be used for implementing a keep alive or * to ensure the client is still responsive, see RFC 6455 Section 5.5.2. * <p> * There is no need to manually write a Pong, as the server and client both handle responding to a ping with a pong * automatically and this is exposed to users.RFC 6455 Section 5.5.3 states that pongs may be sent unsolicited in order * to implement a one way heartbeat. * @param data the data to write, may be at most 125 bytes * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.http.WebSocketBase writePong(io.vertx.rxjava.core.buffer.Buffer data) { delegate.writePong(data.getDelegate()); return this; }