Search in sources :

Example 1 with AnnotatedBinaryArraySocket

use of examples.AnnotatedBinaryArraySocket in project jetty.project by eclipse.

the class EventDriverTest method testAnnotated_ByteArray.

@Test
public void testAnnotated_ByteArray() throws Exception {
    AnnotatedBinaryArraySocket socket = new AnnotatedBinaryArraySocket();
    EventDriver driver = wrap(socket);
    try (LocalWebSocketSession conn = new CloseableLocalWebSocketSession(container, testname, driver)) {
        conn.open();
        driver.incomingFrame(makeBinaryFrame("Hello World", true));
        driver.incomingFrame(new CloseInfo(StatusCode.NORMAL).asFrame());
        socket.capture.assertEventCount(3);
        socket.capture.pop().assertEventStartsWith("onConnect");
        socket.capture.pop().assertEvent("onBinary([11],0,11)");
        socket.capture.pop().assertEventStartsWith("onClose(1000,");
    }
}
Also used : LocalWebSocketSession(org.eclipse.jetty.websocket.common.io.LocalWebSocketSession) CloseableLocalWebSocketSession(org.eclipse.jetty.websocket.common.io.CloseableLocalWebSocketSession) CloseableLocalWebSocketSession(org.eclipse.jetty.websocket.common.io.CloseableLocalWebSocketSession) AnnotatedBinaryArraySocket(examples.AnnotatedBinaryArraySocket) CloseInfo(org.eclipse.jetty.websocket.common.CloseInfo) Test(org.junit.Test)

Aggregations

AnnotatedBinaryArraySocket (examples.AnnotatedBinaryArraySocket)1 CloseInfo (org.eclipse.jetty.websocket.common.CloseInfo)1 CloseableLocalWebSocketSession (org.eclipse.jetty.websocket.common.io.CloseableLocalWebSocketSession)1 LocalWebSocketSession (org.eclipse.jetty.websocket.common.io.LocalWebSocketSession)1 Test (org.junit.Test)1