Package org.cometd.client

Examples of org.cometd.client.BayeuxClient.handshake()


    {
        HttpClient httpClient = new HttpClient();
        httpClient.start();
        BayeuxClient client = new BayeuxClient(oort.getURL(), new LongPollingTransport(null, httpClient));
        client.setAttribute(HttpClient.class.getName(), httpClient);
        client.handshake(handshakeFields);
        clients.add(client);
        return client;
    }

    @After
View Full Code Here


            {
                Assert.assertEquals(0, handshakeLatch.getCount());
                messageLatch.countDown();
            }
        });
        client.handshake();
        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));
        Assert.assertTrue(handshakeLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(messageLatch.await(5, TimeUnit.SECONDS));

        disconnectBayeuxClient(client);
View Full Code Here

                else
                    failedLatch.countDown();
            }
        });

        client.handshake();

        Assert.assertTrue(failureLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(failedLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(successLatch.await(5, TimeUnit.SECONDS));
View Full Code Here

                if (!message.isSuccessful())
                    failedLatch.countDown();
            }
        });

        client.handshake();

        Assert.assertTrue(failureLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(failedLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.DISCONNECTED));
    }
View Full Code Here

    @Test
    public void testMultipleURLMappings() throws Exception
    {
        BayeuxClient client1 = newBayeuxClient(servletPath1);
        client1.handshake();
        Assert.assertTrue(client1.waitFor(5000, BayeuxClient.State.CONNECTED));

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

        BayeuxClient client1 = newBayeuxClient(servletPath1);
        client1.handshake();
        Assert.assertTrue(client1.waitFor(5000, BayeuxClient.State.CONNECTED));

        BayeuxClient client2 = newBayeuxClient(servletPath2);
        client2.handshake();
        Assert.assertTrue(client2.waitFor(5000, BayeuxClient.State.CONNECTED));

        String channelName = "/foobarbaz";
        final CountDownLatch messageLatch = new CountDownLatch(4);
        final CountDownLatch subscribeLatch = new CountDownLatch(2);
View Full Code Here

        });

        int port = connector.getLocalPort();
        stopServer();

        client.handshake();
        Assert.assertTrue(failedLatch.await(5, TimeUnit.SECONDS));

        prepareServer(port, null, true);
        startServer();
View Full Code Here

    @Test
    public void testAbortThenRestart() throws Exception
    {
        BayeuxClient client = newBayeuxClient();
        client.handshake();

        // Need to be sure that the second connect is sent otherwise
        // the abort and rehandshake may happen before the second
        // connect and the test will fail.
        Thread.sleep(1000);
View Full Code Here

            {
                if (message.isSuccessful())
                    connectLatch.countDown();
            }
        });
        client.handshake();
        Assert.assertTrue(connectLatch.await(5, TimeUnit.SECONDS));
        Assert.assertTrue(client.isConnected());

        disconnectBayeuxClient(client);
    }
View Full Code Here

                    connectedLatch.get().countDown();
                else
                    disconnectedLatch.get().countDown();
            }
        });
        client.handshake();

        // Wait for connect
        Assert.assertTrue(connectedLatch.get().await(10, TimeUnit.SECONDS));
        Assert.assertTrue(client.isConnected());
        Thread.sleep(1000);
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.