Package org.atmosphere.websocket

Examples of org.atmosphere.websocket.WebSocketProcessor.open()


            public void destroy() {
            }
        });

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("yoComet").pathInfo("/a").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        processor.invokeWebSocketProtocol(w, "yoWebSocket");
        processor.notifyListener(w, new WebSocketEventListener.WebSocketEvent("Disconnect", DISCONNECT, w));

        assertNotNull(uuid.get());
        assertEquals(uuid.get(), request.getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID));
View Full Code Here


            public void destroy() {
            }
        });

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("yoComet").pathInfo("/a").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        processor.invokeWebSocketProtocol(w, "yoWebSocket");
        processor.notifyListener(w, new WebSocketEventListener.WebSocketEvent("Close", WebSocketEventListener.WebSocketEvent.TYPE.CLOSE, w));

        assertNotNull(uuid.get());
        assertEquals(uuid.get(), request.getAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID));
View Full Code Here

                webSocket.write(webSocket.resource().getRequest().getReader().readLine());
            }
        }));

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("yoComet").pathInfo("/a").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        processor.invokeWebSocketProtocol(w, "yoWebSocket");
        framework.getBroadcasterFactory().lookup("/*").broadcast("yoBroadcast").get();

        assertEquals(b.toString(), "yoCometyoWebSocketyoBroadcast");

View Full Code Here

        Map<String,String> m = new HashMap<String, String>();
        m.put(HeaderConfig.X_ATMOSPHERE_TRANSPORT, HeaderConfig.WEBSOCKET_TRANSPORT);

        AtmosphereRequest request = new AtmosphereRequest.Builder().headers(m).pathInfo("/a").build();
        request.setAttribute(FrameworkConfig.WEBSOCKET_MESSAGE, null);
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));

        final AtomicBoolean dirtyDisconnect = new AtomicBoolean();
        request.setAttribute(SUSPENDED_ATMOSPHERE_RESOURCE_UUID, w.resource().uuid());
        m.put(HeaderConfig.X_ATMOSPHERE_TRANSPORT, HeaderConfig.WEBSOCKET_TRANSPORT);
        request.headers(m);
View Full Code Here

                if (event.isCancelled()) dirtyDisconnect.set(true);
            }
        });
        request.setAttribute(FrameworkConfig.WEBSOCKET_MESSAGE, null);

        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));

        r.get().getBroadcaster().broadcast("yo").get();
        assertTrue(dirtyDisconnect.get());
    }
}
View Full Code Here

        final WebSocket w = new ArrayBaseWebSocket(b);
        final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault()
                .getWebSocketProcessor(framework);

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/ws/bar").method("GET").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        assertEquals(instanceCount, 1);
        assertNotNull(r.get());
        assertEquals(r.get(), "/ws/bar");
    }
View Full Code Here

        final WebSocket w = new ArrayBaseWebSocket(b);
        final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault()
                .getWebSocketProcessor(framework);

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/singleton/ws/bar").method("GET").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        assertEquals(instanceCount, 0);
        assertNotNull(r.get());
        assertEquals(r.get(), "/singleton/ws/bar");
    }
View Full Code Here

        final WebSocketProcessor processor = WebSocketProcessorFactory.getDefault()
                .getWebSocketProcessor(framework);
        registerWebSocketHandler("/*", new EchoHandler());

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("yoComet").pathInfo("/a").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        processor.invokeWebSocketProtocol(w, "yoWebSocket");

        assertEquals(b.toString(), "yoWebSocket");
    }

View Full Code Here

                .getWebSocketProcessor(framework);
        registerWebSocketHandler("/a", new EchoHandler());

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("yoComet").pathInfo("/abcd").build();
        try {
            processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
            fail();
        } catch (Exception ex) {
            assertEquals(ex.getClass(), AtmosphereMappingException.class);
        }
    }
View Full Code Here

        registerWebSocketHandler("/a", new EchoHandler());
        registerWebSocketHandler("/b", new EchoHandler());

        AtmosphereRequest request = new AtmosphereRequest.Builder().destroyable(false).body("a").pathInfo("/a").build();
        processor.open(w, request, AtmosphereResponse.newInstance(framework.getAtmosphereConfig(), request, w));
        processor.invokeWebSocketProtocol(w, "a");

        assertEquals(b.toString(), "a");

        request = new AtmosphereRequest.Builder().destroyable(false).body("b").pathInfo("/b").build();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.