Examples of JettyJSONContextClient


Examples of org.cometd.common.JettyJSONContextClient

                "\"subscription\": \"" + channelName + "\"" +
                "}]");
        response = connect1.send();
        Assert.assertEquals(200, response.getStatus());

        JettyJSONContextClient parser = new JettyJSONContextClient();
        Message.Mutable[] messages = parser.parse(response.getContentAsString());

        Assert.assertEquals(2, messages.length);

        Message.Mutable connectReply = messages[0];
        Assert.assertEquals(Channel.META_CONNECT, connectReply.getChannel());
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

        Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));

        response = listener.get(5, TimeUnit.SECONDS);
        Assert.assertEquals(200, response.getStatus());
        Message.Mutable connectReply = new JettyJSONContextClient().parse(response.getContentAsString())[0];
        Assert.assertEquals(Channel.META_CONNECT, connectReply.getChannel());
        Map<String, Object> advice = connectReply.getAdvice(false);
        Assert.assertTrue(Message.RECONNECT_NONE_VALUE.equals(advice.get(Message.RECONNECT_FIELD)));
    }
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

        // Wait for the second connect to return
        response = futureResponse.get(timeout * 2, TimeUnit.SECONDS);
        Assert.assertEquals(200, response.getStatus());

        JSONContext.Client jsonContext = new JettyJSONContextClient();
        Message.Mutable[] messages = jsonContext.parse(response.getContentAsString());
        Message.Mutable connect = messages[0];
        Map<String,Object> advice = connect.getAdvice();
        Assert.assertNotNull(advice);
        Number timeout = (Number)advice.get("timeout");
        Assert.assertNotNull(timeout);
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

        // Wait for the second connect to return
        response = futureResponse.get(timeout * 2, TimeUnit.SECONDS);
        Assert.assertEquals(200, response.getStatus());

        JSONContext.Client jsonContext = new JettyJSONContextClient();
        Message.Mutable[] messages = jsonContext.parse(response.getContentAsString());
        Message.Mutable connect = messages[0];
        Map<String,Object> advice = connect.getAdvice();
        Assert.assertNotNull(advice);
        Number interval = (Number)advice.get("interval");
        Assert.assertNotNull(interval);
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

                "}" +
                "}]");
        response = connect2.send();
        Assert.assertEquals(200, response.getStatus());

        JSONContext.Client jsonContext = new JettyJSONContextClient();
        Message.Mutable[] messages = jsonContext.parse(response.getContentAsString());
        Message.Mutable connect = messages[0];
        Map<String,Object> advice = connect.getAdvice();
        Assert.assertNotNull(advice);
        Number interval = (Number)advice.get("interval");
        Assert.assertNotNull(interval);
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

                "\"connectionType\": \"long-polling\"" +
                "}]");
        response = connect2.send();
        Assert.assertEquals(200, response.getStatus());

        Message.Mutable reply = new JettyJSONContextClient().parse(response.getContentAsString())[0];
        Assert.assertEquals(Channel.META_CONNECT, reply.getChannel());
        Map<String, Object> advice = reply.getAdvice(false);
        if (advice != null)
            Assert.assertFalse(Message.RECONNECT_NONE_VALUE.equals(advice.get(Message.RECONNECT_FIELD)));
    }
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

        response = connect1.send();
        Assert.assertEquals(200, response.getStatus());

        Assert.assertTrue(sweeperLatch.await(maxInterval, TimeUnit.MILLISECONDS));

        Message.Mutable reply = new JettyJSONContextClient().parse(response.getContentAsString())[0];
        Assert.assertEquals(Channel.META_CONNECT, reply.getChannel());
        Map<String, Object> advice = reply.getAdvice(false);
        if (advice != null)
            Assert.assertFalse(Message.RECONNECT_NONE_VALUE.equals(advice.get(Message.RECONNECT_FIELD)));
    }
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

        response = connect1.send();
        Assert.assertEquals(200, response.getStatus());

        Assert.assertTrue(sweeperLatch.await(maxInterval, TimeUnit.MILLISECONDS));

        Message.Mutable[] replies = new JettyJSONContextClient().parse(response.getContentAsString());
        Message.Mutable reply = replies[replies.length - 1];
        Assert.assertEquals(Channel.META_CONNECT, reply.getChannel());
        Map<String, Object> advice = reply.getAdvice(false);
        if (advice != null)
            Assert.assertFalse(Message.RECONNECT_NONE_VALUE.equals(advice.get(Message.RECONNECT_FIELD)));
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

                "\"subscription\": [\"/foo\",\"/bar\"]" +
                "}]");
        response = subscribe.send();
        Assert.assertEquals(200, response.getStatus());

        JSONContext.Client jsonContext = new JettyJSONContextClient();
        Message.Mutable[] messages = jsonContext.parse(response.getContentAsString());
        Assert.assertEquals(1, messages.length);
        Message.Mutable message = messages[0];
        Assert.assertTrue(message.isSuccessful());
        Object subscriptions = message.get(Message.SUBSCRIPTION_FIELD);
        Assert.assertTrue(subscriptions instanceof Object[]);
View Full Code Here

Examples of org.cometd.common.JettyJSONContextClient

                "\"subscription\": [\"/foo\",\"/bar\"]" +
                "}]");
        response = unsubscribe.send();
        Assert.assertEquals(200, response.getStatus());

        JSONContext.Client jsonContext = new JettyJSONContextClient();
        Message.Mutable[] messages = jsonContext.parse(response.getContentAsString());
        Assert.assertEquals(1, messages.length);
        Message.Mutable message = messages[0];
        Assert.assertTrue(message.isSuccessful());
        Object subscriptions = message.get(Message.SUBSCRIPTION_FIELD);
        Assert.assertTrue(subscriptions instanceof Object[]);
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.