Package org.cometd.bayeux.server

Examples of org.cometd.bayeux.server.LocalSession.handshake()


        Object service = new RemoteCallWithFailureService();
        boolean processed = processor.process(service);
        assertTrue(processed);

        LocalSession remote = bayeuxServer.newLocalSession("remoteCall");
        remote.handshake();
        ClientSessionChannel channel = remote.getChannel(Channel.SERVICE + RemoteCallWithFailureService.CHANNEL);
        final CountDownLatch latch = new CountDownLatch(1);
        channel.addListener(new ClientSessionChannel.MessageListener()
        {
            @Override
View Full Code Here


        Object service = new RemoteCallWithUncaughtExceptionService();
        boolean processed = processor.process(service);
        assertTrue(processed);

        LocalSession remote = bayeuxServer.newLocalSession("remoteCall");
        remote.handshake();
        ClientSessionChannel channel = remote.getChannel(Channel.SERVICE + RemoteCallWithUncaughtExceptionService.CHANNEL);
        final CountDownLatch latch = new CountDownLatch(1);
        channel.addListener(new ClientSessionChannel.MessageListener()
        {
            @Override
View Full Code Here

        Server serverA = startServer(0);
        final Oort oortA = startOort(serverA);
        final BayeuxServer bayeuxServerA = oortA.getBayeuxServer();

        final LocalSession serviceA = bayeuxServerA.newLocalSession("test");
        serviceA.handshake();
        final String channelName = "/test";
        final String data = "data";
        final CountDownLatch joinedLatch = new CountDownLatch(1);
        oortA.addCometListener(new Oort.CometListener.Adapter()
        {
View Full Code Here

    public void testHighRateServerEvents() throws Exception
    {
        final String channelName = "/foo";

        LocalSession service = bayeux.newLocalSession("high_rate_test");
        service.handshake();

        final BayeuxClient client = newBayeuxClient();
        client.handshake();
        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));
View Full Code Here

    @Test
    public void testSessionAttributes() throws Exception
    {
        LocalSession local = _bayeux.newLocalSession("s0");
        local.handshake();
        ServerSession session = local.getServerSession();

        local.setAttribute("foo","bar");
        Assert.assertEquals("bar",local.getAttribute("foo"));
        Assert.assertEquals(null,session.getAttribute("foo"));
View Full Code Here

    @Test
    public void testLocalSessions() throws Exception
    {
        LocalSession session0 = _bayeux.newLocalSession("s0");
        Assert.assertEquals("L:s0_", session0.toString());
        session0.handshake();
        Assert.assertNotEquals("L:s0_", session0.toString());
        Assert.assertTrue(session0.toString().startsWith("L:s0_"));

        final LocalSession session1 = _bayeux.newLocalSession("s1");
        session1.handshake();
View Full Code Here

        session0.handshake();
        Assert.assertNotEquals("L:s0_", session0.toString());
        Assert.assertTrue(session0.toString().startsWith("L:s0_"));

        final LocalSession session1 = _bayeux.newLocalSession("s1");
        session1.handshake();
        final LocalSession session2 = _bayeux.newLocalSession("s2");
        session2.handshake();

        final Queue<String> events = new ConcurrentLinkedQueue<>();
View Full Code Here

        Assert.assertTrue(session0.toString().startsWith("L:s0_"));

        final LocalSession session1 = _bayeux.newLocalSession("s1");
        session1.handshake();
        final LocalSession session2 = _bayeux.newLocalSession("s2");
        session2.handshake();

        final Queue<String> events = new ConcurrentLinkedQueue<>();

        ClientSessionChannel.MessageListener listener = new ClientSessionChannel.MessageListener()
        {
View Full Code Here

                return !"ignoreRcv".equals(message.getData());
            }
        });

        final LocalSession session0 = _bayeux.newLocalSession("s0");
        session0.handshake();
        //final LocalSession session1 = _bayeux.newLocalSession("s1");
        //session1.handshake();

        session0.addExtension(new ClientSession.Extension.Adapter()
        {
View Full Code Here

        ServerTransport serverTransport = bayeuxServer.getTransport("long-polling");
        bayeuxServer.setCurrentTransport((AbstractServerTransport)serverTransport);

        // LocalSessions do not perform heartbeat so we should not sweep them until disconnected
        LocalSession localSession = bayeuxServer.newLocalSession("test_sweep");
        localSession.handshake();

        bayeuxServer.sweep();

        Assert.assertNotNull(bayeuxServer.getSession(localSession.getId()));
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.