Search in sources :

Example 6 with OutgoingFrames

use of org.eclipse.jetty.websocket.api.extensions.OutgoingFrames in project jetty.project by eclipse.

the class MessageOutputStreamTest method setupSession.

@Before
public void setupSession() throws Exception {
    policy = WebSocketPolicy.newServerPolicy();
    policy.setInputBufferSize(1024);
    policy.setMaxBinaryMessageBufferSize(1024);
    // Container
    WebSocketContainerScope containerScope = new SimpleContainerScope(policy, bufferPool);
    // Event Driver factory
    EventDriverFactory factory = new EventDriverFactory(containerScope);
    // local socket
    EventDriver driver = factory.wrap(new TrackingSocket("local"));
    // remote socket
    socket = new TrackingSocket("remote");
    OutgoingFrames socketPipe = FramePipes.to(factory.wrap(socket));
    session = new LocalWebSocketSession(containerScope, testname, driver);
    session.setPolicy(policy);
    // talk to our remote socket
    session.setOutgoingHandler(socketPipe);
    // start session
    session.start();
    // open connection
    session.open();
}
Also used : EventDriver(org.eclipse.jetty.websocket.common.events.EventDriver) LocalWebSocketSession(org.eclipse.jetty.websocket.common.io.LocalWebSocketSession) EventDriverFactory(org.eclipse.jetty.websocket.common.events.EventDriverFactory) WebSocketContainerScope(org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope) OutgoingFrames(org.eclipse.jetty.websocket.api.extensions.OutgoingFrames) SimpleContainerScope(org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope) Before(org.junit.Before)

Aggregations

OutgoingFrames (org.eclipse.jetty.websocket.api.extensions.OutgoingFrames)6 IncomingFrames (org.eclipse.jetty.websocket.api.extensions.IncomingFrames)2 EventDriver (org.eclipse.jetty.websocket.common.events.EventDriver)2 EventDriverFactory (org.eclipse.jetty.websocket.common.events.EventDriverFactory)2 LocalWebSocketSession (org.eclipse.jetty.websocket.common.io.LocalWebSocketSession)2 SimpleContainerScope (org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope)2 WebSocketContainerScope (org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope)2 Before (org.junit.Before)2 Test (org.junit.Test)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 URI (java.net.URI)1 Random (java.util.Random)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ClientEndpointConfig (javax.websocket.ClientEndpointConfig)1 Extension (javax.websocket.Extension)1 SendHandler (javax.websocket.SendHandler)1 SendResult (javax.websocket.SendResult)1 Session (javax.websocket.Session)1 RuntimeIOException (org.eclipse.jetty.io.RuntimeIOException)1