Package org.cometd.bayeux.server

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


        String parentChannel = new ChannelId(ListenerWithParametersService.CHANNEL).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
        message.setChannel(parentChannel + "/" + value);
        message.setData(new HashMap());
        bayeuxServer.handle((ServerSessionImpl)remote.getServerSession(), message);
View Full Code Here


        String parentChannel = new ChannelId(ListenerWithParametersNotBindingService.CHANNEL).getParent();
        String grandParentChannel = new ChannelId(parentChannel).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
        // Wrong channel (does not bind to the template), the message must not be delivered.
        message.setChannel(grandParentChannel + "/test");
        message.setData(new HashMap());
        bayeuxServer.handle((ServerSessionImpl)remote.getServerSession(), message);
View Full Code Here

        String parentChannel = new ChannelId(SubscriberWithParametersService.CHANNEL).getParent();

        // Fake a publish
        LocalSession remote = bayeuxServer.newLocalSession("remote");
        remote.handshake();
        ServerMessage.Mutable message = bayeuxServer.newMessage();
        message.setChannel(parentChannel + "/" + value);
        message.setData(new HashMap());
        bayeuxServer.handle((ServerSessionImpl)remote.getServerSession(), message);
View Full Code Here

        final String dataContent = "random";
        final long extraContent = 13;
        final CountDownLatch latch = new CountDownLatch(1);

        LocalSession service = bayeux.newLocalSession("custom_serialization");
        service.handshake();
        service.getChannel(channelName).subscribe(new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Data data = (Data)message.getData();
View Full Code Here

        String channelName = "/data";
        final String content = "random";
        final CountDownLatch latch = new CountDownLatch(1);

        LocalSession service = bayeux.newLocalSession("custom_serialization");
        service.handshake();
        service.getChannel(channelName).subscribe(new ClientSessionChannel.MessageListener()
        {
            public void onMessage(ClientSessionChannel channel, Message message)
            {
                Data data = (Data)message.getData();
View Full Code Here

            {
            }
        });

        LocalSession session = bayeux.newLocalSession("test");
        session.handshake();

        String channelName = "/test";
        final CountDownLatch messageLatch = new CountDownLatch(1);
        session.getChannel(channelName).subscribe(new ClientSessionChannel.MessageListener()
        {
View Full Code Here

        Object service = new RemoteCallWithResultService(callerData, calleeData);
        boolean processed = processor.process(service);
        assertTrue(processed);

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

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

        LocalSession remote = bayeuxServer.newLocalSession("remoteCall");
        remote.handshake();

        final String parameter = "param1";
        ClientSessionChannel channel = remote.getChannel(Channel.SERVICE + "/test/" + parameter);
        final CountDownLatch latch = new CountDownLatch(1);
        channel.addListener(new ClientSessionChannel.MessageListener()
View Full Code Here

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

        LocalSession remote1 = bayeuxServer.newLocalSession("remoteCall1");
        remote1.handshake();

        LocalSession remote2 = bayeuxServer.newLocalSession("remoteCall2");
        remote2.handshake();

        final CountDownLatch latch = new CountDownLatch(2);
View Full Code Here

        LocalSession remote1 = bayeuxServer.newLocalSession("remoteCall1");
        remote1.handshake();

        LocalSession remote2 = bayeuxServer.newLocalSession("remoteCall2");
        remote2.handshake();

        final CountDownLatch latch = new CountDownLatch(2);
        final List<Message> responses = new ArrayList<>();

        ClientSessionChannel channel1 = remote1.getChannel(Channel.SERVICE + TwoRemoteCallsWithResultService.CHANNEL);
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.