Package org.cometd.client.transport

Examples of org.cometd.client.transport.LongPollingTransport


    private HttpClient createHttpClient() throws SDKException {
        return httpClientProvider.get();
    }

    private LongPollingTransport createTransport(final HttpClient httpClient) {
        LongPollingTransport transport = new CumulocityLongPollingTransport(createTransportOptions(), httpClient, paramters);
        if (!httpClient.isStarted()) {
            try {
                httpClient.start();
            } catch (Exception x) {
                throw new RuntimeException(x);
View Full Code Here


        if (session.getAccessToken() == null) {
            // lazy login here!
            session.login(null);
        }

        LongPollingTransport transport = new LongPollingTransport(options, httpClient) {
            @Override
            protected void customize(ContentExchange exchange) {
                super.customize(exchange);
                // add SalesforceSecurityListener to handle token expiry
                final String accessToken = session.getAccessToken();
View Full Code Here

        client1.getChannel("/service/login").publish(login1);

        final AtomicReference<String> session2 = new AtomicReference<>();
        HttpClient httpClient = new HttpClient();
        httpClient.start();
        BayeuxClient client2 = new BayeuxClient(oort2.getURL(), new LongPollingTransport(null, httpClient))
        {
            @Override
            protected void processConnect(Message.Mutable connect)
            {
                // Send the login message, so Seti can associate this user
View Full Code Here

    }

    @Test
    public void testHandshakeFailsBeforeSend() throws Exception
    {
        LongPollingTransport transport = new LongPollingTransport(null, httpClient)
        {
            @Override
            protected void customize(Request request)
            {
                request.listener(new Request.Listener.Adapter()
View Full Code Here

    }

    @Test
    public void testHandshakeFailsBadTransport() throws Exception
    {
        LongPollingTransport transport = new LongPollingTransport(null, httpClient)
        {
            @Override
            protected void customize(Request request)
            {
                // Modify the request so that the server chokes it
View Full Code Here

    {
        final AtomicReference<Message> handshake = new AtomicReference<>();
        final CountDownLatch handshakeLatch = new CountDownLatch(1);
        final CountDownLatch connectLatch = new CountDownLatch(1);

        final BayeuxClient client = new BayeuxClient(cometdURL, new LongPollingTransport(null, httpClient))
        {
            @Override
            protected void processHandshake(Message.Mutable message)
            {
                // Force no transports
View Full Code Here

        context.addFilter(new FilterHolder(filter), "/*", EnumSet.of(DispatcherType.REQUEST));
        context.start();

        final BlockingArrayQueue<Message> queue = new BlockingArrayQueue<>(100, 100);
        final AtomicBoolean connected = new AtomicBoolean(false);
        BayeuxClient client = new BayeuxClient(cometdURL, new LongPollingTransport(null, httpClient))
        {
            @Override
            public void onFailure(Throwable failure, List<? extends Message> messages)
            {
                Message.Mutable problem = newMessage();
View Full Code Here

    @Test
    public void testConnectRetries() throws Exception
    {
        final AtomicInteger connects = new AtomicInteger();
        final CountDownLatch attempts = new CountDownLatch(4);
        final BayeuxClient client = new BayeuxClient(cometdURL, new LongPollingTransport(null, httpClient))
        {
            @Override
            protected boolean scheduleConnect(long interval, long backoff)
            {
                int count = connects.get();
View Full Code Here

        {
            listening.set(false);
        }

        final CountDownLatch latch = new CountDownLatch(1);
        BayeuxClient client = new BayeuxClient("http://localhost/cometd", new LongPollingTransport(null, httpClient));
        client.getChannel(Channel.META_HANDSHAKE).addListener(new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Assert.assertFalse(message.isSuccessful());
View Full Code Here

    @Test
    public void testAbortThenRestart() throws Exception
    {
        final AtomicReference<CountDownLatch> connectLatch = new AtomicReference<>(new CountDownLatch(2));
        BayeuxClient client = new BayeuxClient(cometdURL, new LongPollingTransport(null, httpClient))
        {
            @Override
            public void onSending(List<? extends Message> messages)
            {
                // Need to be sure that the second connect is sent otherwise
View Full Code Here

TOP

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

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.