Package org.cometd.client.transport

Examples of org.cometd.client.transport.ClientTransport


    {
        prepareAndStart(null);

        final AtomicReference<List<Message.Mutable>> batch = new AtomicReference<>();
        final CountDownLatch repliesLatch = new CountDownLatch(1);
        ClientTransport transport;
        switch (wsTransportType)
        {
            case WEBSOCKET_JSR_356:
                transport = new org.cometd.websocket.client.WebSocketTransport(null, null, null, wsClientContainer)
                {
View Full Code Here


                return true;
            }
        });

        final CountDownLatch latch = new CountDownLatch(2);
        ClientTransport transport = new LongPollingTransport(null, httpClient);
        transport.setOption(ClientTransport.MAX_NETWORK_DELAY_OPTION, maxNetworkDelay);
        BayeuxClient client = new BayeuxClient(cometdURL, transport)
        {
            @Override
            public void onFailure(Throwable failure, List<? extends Message> messages)
            {
View Full Code Here

                return true;
            }
        });

        final CountDownLatch latch = new CountDownLatch(3);
        ClientTransport transport = new LongPollingTransport(null, httpClient);
        transport.setOption(ClientTransport.MAX_NETWORK_DELAY_OPTION, maxNetworkDelay);
        BayeuxClient client = new BayeuxClient(cometdURL, transport)
        {
            @Override
            public void onFailure(Throwable failure, List<? extends Message> messages)
            {
View Full Code Here

            public void destroy()
            {
            }
        }), cometdServletPath, EnumSet.of(DispatcherType.REQUEST, DispatcherType.ASYNC));

        ClientTransport webSocketTransport = newWebSocketTransport(null);
        ClientTransport longPollingTransport = newLongPollingTransport(null);
        final BayeuxClient client = new BayeuxClient(cometdURL, webSocketTransport, longPollingTransport);

        final CountDownLatch latch = new CountDownLatch(1);
        client.getChannel(Channel.META_CONNECT).addListener(new ClientSessionChannel.MessageListener()
        {
View Full Code Here

    }

    @Test
    public void testCustomTransportURL() throws Exception
    {
        ClientTransport transport = newWebSocketTransport(cometdURL, null);
        // Pass a bogus URL that must not be used
        BayeuxClient client = new BayeuxClient("http://foo/bar", transport);

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

        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        // Wait for connect to establish
        Thread.sleep(1000);

        ClientTransport clientTransport = client.getTransport();
        Assert.assertEquals("websocket", clientTransport.getName());

        disconnectBayeuxClient(client);
    }
View Full Code Here

        return newWebSocketTransport(null, options);
    }

    protected ClientTransport newWebSocketTransport(String url, Map<String, Object> options)
    {
        ClientTransport result;
        switch (wsTransportType)
        {
            case WEBSOCKET_JSR_356:
                result = new org.cometd.websocket.client.WebSocketTransport(url, options, null, wsClientContainer);
                break;
View Full Code Here

        Assert.assertTrue(client.waitFor(5000, BayeuxClient.State.CONNECTED));

        // Wait for connect to establish
        Thread.sleep(1000);

        ClientTransport clientTransport = client.getTransport();
        Assert.assertEquals("websocket", clientTransport.getName());

        disconnectBayeuxClient(client);
    }
View Full Code Here

        for (ClientTransport t : transports)
            transportRegistry.add(t);

        for (String transportName : transportRegistry.getKnownTransports())
        {
            ClientTransport clientTransport = transportRegistry.getTransport(transportName);
            if (clientTransport instanceof MessageClientTransport)
            {
                ((MessageClientTransport)clientTransport).setMessageTransportListener(publishListener);
            }
            if (clientTransport instanceof HttpClientTransport)
View Full Code Here

    {
        initialize();

        List<String> allowedTransports = getAllowedTransports();
        // Pick the first transport for the handshake, it will renegotiate if not right
        final ClientTransport initialTransport = transportRegistry.negotiate(allowedTransports.toArray(), BAYEUX_VERSION).get(0);
        prepareTransport(null, initialTransport);
        if (logger.isDebugEnabled())
            logger.debug("Using initial transport {} from {}", initialTransport.getName(), allowedTransports);

        updateBayeuxClientState(new BayeuxClientStateUpdater()
        {
            public BayeuxClientState create(BayeuxClientState oldState)
            {
View Full Code Here

TOP

Related Classes of org.cometd.client.transport.ClientTransport

Copyright © 2018 www.massapicom. 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.