Examples of AtmosphereRequest


Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testMessage() throws IOException, ServletException {

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/e").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
        r.get().resume();
        assertNotNull(message.get());
        assertEquals(message.get(), "message");
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

        }
    }

    @Test
    public void testMessageWithResource() throws IOException, ServletException {
        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/k").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
        r.get().resume();
        assertNotNull(message.get());
        assertEquals(message.get(), "message");
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testSuspend() throws IOException, ServletException {

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/j").method("GET").build();
        request.header(X_ATMOSPHERE_TRANSPORT, LONG_POLLING_TRANSPORT);
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
    }
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testPriority() throws IOException, ServletException {

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/priority").method("GET").build();
        request.header(X_ATMOSPHERE_TRANSPORT, LONG_POLLING_TRANSPORT);
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertEquals(framework.getAtmosphereHandlers().get("/priority").interceptors.getFirst().toString(), "XXX");

        assertNotNull(r.get());
    }
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    @Test
    public void testOverrideBroadcaster() throws IOException, ServletException {
        framework.setDefaultBroadcasterClassName(SimpleBroadcaster.class.getName());

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/override").method("GET").build();
        request.header(X_ATMOSPHERE_TRANSPORT, LONG_POLLING_TRANSPORT);
        framework.doCometSupport(request, AtmosphereResponse.newInstance());

        assertNotNull(r.get());
        assertEquals(r.get().getBroadcaster().getClass().getName(), SimpleBroadcaster.class.getName());
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testReaderMessage() throws IOException, ServletException {

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/readerInjection").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
        r.get().resume();
        assertNotNull(message.get());
        assertEquals(message.get(), "message");
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

        }
    }

    @Test
    public void testInputStreamMessage() throws IOException, ServletException {
        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/inputStreamInjection").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
        r.get().resume();
        assertNotNull(message.get());
        assertEquals(message.get(), "message");
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testHeartbeat() throws IOException, ServletException {
        // Open connection
        AtmosphereRequest request = new AtmosphereRequest.Builder()
                .pathInfo("/heartbeat")
                .method("GET")
                .build();

        request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
        framework.doCometSupport(request, AtmosphereResponse.newInstance());

        // Check suspend
        final AtmosphereResource res = r.get();
        assertNotNull(res);

        // Send heartbeat
        request = new AtmosphereRequest.Builder()
                .pathInfo("/heartbeat")
                .method("GET")
                .body(Heartbeat.paddingData)
                .build();
        request.header(X_ATMOSPHERE_TRANSPORT, WEBSOCKET_TRANSPORT);
        request.setAttribute(HeartbeatInterceptor.INTERCEPTOR_ADDED, "");
        res.initialize(res.getAtmosphereConfig(), res.getBroadcaster(), request, AtmosphereResponse.newInstance(), framework.getAsyncSupport(), res.getAtmosphereHandler());
        request.setAttribute(FrameworkConfig.INJECTED_ATMOSPHERE_RESOURCE, res);
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(message.get());
        assertEquals(message.get(), Heartbeat.paddingData);
    }
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

    }

    @Test
    public void testInjectAnnotation() throws IOException, ServletException {

        AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/injectAnnotation").method("GET").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());
        assertNotNull(r.get());
        r.get().resume();
        assertNotNull(message.get());
        assertEquals(message.get(), framework.sessionFactory().toString());
View Full Code Here

Examples of org.atmosphere.cpr.AtmosphereRequest

        public void get(AtmosphereResource resource) {
            r.set(resource);
            resource.addEventListener(new OnSuspend() {
                @Override
                public void onSuspend(AtmosphereResourceEvent event) {
                    AtmosphereRequest request = new AtmosphereRequest.Builder().pathInfo("/e").method("POST").body("message").build();

                    try {
                        event.getResource().getAtmosphereConfig().framework().doCometSupport(request, AtmosphereResponse.newInstance());
                    } catch (IOException e) {
                        e.printStackTrace();
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.