Search in sources :

Example 26 with WebSocketProcessor

use of org.atmosphere.websocket.WebSocketProcessor in project atmosphere by Atmosphere.

the class ManagedAtmosphereHandlerTest method testWebSocketFactory.

@Test
public void testWebSocketFactory() throws IOException, ServletException {
    ByteArrayOutputStream b = new ByteArrayOutputStream();
    final WebSocket w = new ArrayBaseWebSocket(b);
    final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault().getWebSocketProcessor(framework);
    AtmosphereRequest request = new AtmosphereRequestImpl.Builder().destroyable(false).body("yoComet").pathInfo("/websocketfactory").build();
    processor.open(w, request, AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), request, w));
    assertNotNull(r.get());
    assertTrue(Interceptor.invoked);
}
Also used : AtmosphereRequest(org.atmosphere.runtime.AtmosphereRequest) WebSocketProcessor(org.atmosphere.websocket.WebSocketProcessor) ByteArrayOutputStream(java.io.ByteArrayOutputStream) WebSocket(org.atmosphere.websocket.WebSocket) Test(org.testng.annotations.Test)

Aggregations

WebSocketProcessor (org.atmosphere.websocket.WebSocketProcessor)26 ByteArrayOutputStream (java.io.ByteArrayOutputStream)22 WebSocket (org.atmosphere.websocket.WebSocket)22 Test (org.testng.annotations.Test)21 IOException (java.io.IOException)12 AtomicReference (java.util.concurrent.atomic.AtomicReference)5 AtmosphereRequest (org.atmosphere.runtime.AtmosphereRequest)3 DefaultWebSocketProcessor (org.atmosphere.websocket.DefaultWebSocketProcessor)3 WebSocketEventListenerAdapter (org.atmosphere.websocket.WebSocketEventListenerAdapter)3 HashMap (java.util.HashMap)2 ExecutionException (java.util.concurrent.ExecutionException)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 ServletException (javax.servlet.ServletException)2 Cookie (javax.servlet.http.Cookie)2 AtmosphereRequestImpl (org.atmosphere.runtime.AtmosphereRequestImpl)2 WebSocketEventListener (org.atmosphere.websocket.WebSocketEventListener)2 Reader (java.io.Reader)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 ExecutorService (java.util.concurrent.ExecutorService)1