Search in sources :

Example 1 with AnnotatedBinaryStreamSocket

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

the class EventDriverTest method testAnnotated_InputStream.

@Test
public void testAnnotated_InputStream() throws IOException, TimeoutException, InterruptedException {
    AnnotatedBinaryStreamSocket socket = new AnnotatedBinaryStreamSocket();
    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().assertEventRegex("^onBinary\\(.*InputStream.*");
        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) AnnotatedBinaryStreamSocket(examples.AnnotatedBinaryStreamSocket) CloseInfo(org.eclipse.jetty.websocket.common.CloseInfo) Test(org.junit.Test)

Aggregations

AnnotatedBinaryStreamSocket (examples.AnnotatedBinaryStreamSocket)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