use of org.eclipse.jetty.websocket.common.events.EventDriver in project jetty.project by eclipse.
the class JsrSessionTest method initSession.
@Before
public void initSession() {
container = new ClientContainer();
String id = JsrSessionTest.class.getSimpleName();
URI requestURI = URI.create("ws://localhost/" + id);
WebSocketPolicy policy = WebSocketPolicy.newClientPolicy();
ClientEndpointConfig config = new EmptyClientEndpointConfig();
DummyEndpoint websocket = new DummyEndpoint();
SimpleEndpointMetadata metadata = new SimpleEndpointMetadata(websocket.getClass());
// Executor executor = null;
EndpointInstance ei = new EndpointInstance(websocket, config, metadata);
EventDriver driver = new JsrEndpointEventDriver(policy, ei);
DummyConnection connection = new DummyConnection();
session = new JsrSession(container, id, requestURI, driver, connection);
}
use of org.eclipse.jetty.websocket.common.events.EventDriver 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();
}
Aggregations