Examples of AtmosphereHandlerAdapter


Examples of org.atmosphere.handler.AtmosphereHandlerAdapter

    AtmosphereResource atmosphereResource = new AtmosphereResourceImpl();
    AtmosphereRequest atmosphereRequest = AtmosphereRequest.wrap(wicketTester.getRequest());
    AtmosphereResponse atmosphereResponse = AtmosphereResponse.wrap(wicketTester.getResponse());
    TesterAsyncSupport asyncSupport = new TesterAsyncSupport();
    atmosphereResource.initialize(broadcaster.getApplicationConfig(), broadcaster, atmosphereRequest, atmosphereResponse,
        asyncSupport, new AtmosphereHandlerAdapter());

    atmosphereResource.setBroadcaster(broadcaster);
    broadcaster.addAtmosphereResource(atmosphereResource);

    String uuid = atmosphereResource.uuid();
View Full Code Here

Examples of org.atmosphere.handler.AtmosphereHandlerAdapter

        config.getBroadcasterFactory().lookup("/1", true).broadcast(("1")).get();
        config.getBroadcasterFactory().lookup("/2", true).broadcast(("2")).get();
        config.getBroadcasterFactory().lookup("/3", true).broadcast(("3")).get();
        config.getBroadcasterFactory().lookup("/4", true).broadcast(("4")).get();

        r2.transport(AtmosphereResource.TRANSPORT.LONG_POLLING).atmosphereHandler(new AtmosphereHandlerAdapter() {
            @Override
            public void onStateChange(AtmosphereResourceEvent event) throws IOException {
                ref.set(event.getMessage());
            }
        }).suspend();
View Full Code Here

Examples of org.atmosphere.handler.AtmosphereHandlerAdapter

    @Test
    public void testTrackAndTryAcquire() throws IOException, ServletException, InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);

        final AtomicReference<AtmosphereSession> session = new AtomicReference<AtmosphereSession>();
        framework.addAtmosphereHandler("/acquire", new AtmosphereHandlerAdapter() {
            @Override
            public void onRequest(AtmosphereResource resource) throws IOException {
                if (session.get() == null) {
                    session.set(new AtmosphereSession(resource));
                }
                resource.suspend(2, TimeUnit.SECONDS);
            }

            @Override
            public void onStateChange(AtmosphereResourceEvent event) throws IOException {
                latch.countDown();
            }
        });
        final String qs = "&X-Atmosphere-tracking-id=c8834462-c46e-4dad-a22f-b86aabe3f883&X-Atmosphere-Framework=2.0.4-javascript&X-Atmosphere-Transport=sse&X-Atmosphere-TrackMessageSize=true&X-atmo-protocol=true&_=1380799455333";
        AtmosphereRequest request = new AtmosphereRequest.Builder().queryString(qs).pathInfo("/acquire").build();
        framework.doCometSupport(request, AtmosphereResponse.newInstance());

        latch.await(10, TimeUnit.SECONDS);
        assertNull(session.get().acquire());

        final AtomicReference<AtmosphereResource> rrr = new AtomicReference<AtmosphereResource>();
        final CountDownLatch _latch = new CountDownLatch(1);
        framework.addAtmosphereHandler("/acquire", new AtmosphereHandlerAdapter() {
            @Override
            public void onRequest(final AtmosphereResource resource) throws IOException {
                resource.suspend(2, TimeUnit.SECONDS);
            }
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.