Package org.jboss.aerogear.simplepush.protocol

Examples of org.jboss.aerogear.simplepush.protocol.HelloResponse


    @Test
    public void handleHandshakeWithEmptyChannels() throws ChannelNotFoundException {
        final Set<String> channelIds = Collections.emptySet();
        final String uaid = UUIDUtil.newUAID();
        final HelloMessage handshakeImpl = new HelloMessageImpl(uaid, channelIds);
        final HelloResponse response = server.handleHandshake(handshakeImpl);
        assertThat(response.getUAID(), is(notNullValue()));
        assertThat(server.hasChannel(uaid, "channel1"), is(false));
    }
View Full Code Here


        final String channelId1 = UUID.randomUUID().toString();
        final String channelId2 = UUID.randomUUID().toString();
        final Set<String> channelIds = new HashSet<String>(Arrays.asList(channelId1, channelId2));
        final String uaid = UUIDUtil.newUAID();
        final HelloMessage firstHello = new HelloMessageImpl(uaid, channelIds);
        final HelloResponse firstResponse = server.handleHandshake(firstHello);
        assertThat(firstResponse.getUAID(), equalTo(uaid));
        assertThat(server.hasChannel(uaid, channelId1), is(true));
        assertThat(server.hasChannel(uaid, channelId2), is(true));

        final HelloMessage nextHello = new HelloMessageImpl(uaid, Collections.<String>emptySet());
        final HelloResponse secondResponse = server.handleHandshake(nextHello);
        assertThat(secondResponse.getUAID(), equalTo(uaid));
        assertThat(server.hasChannel(secondResponse.getUAID(), channelId1), is(false));
        assertThat(server.hasChannel(secondResponse.getUAID(), channelId2), is(false));
    }
View Full Code Here

        final String uaid = UUIDUtil.newUAID();
        final String channelId1 = UUID.randomUUID().toString();
        final String channelId2 = UUID.randomUUID().toString();
        final Set<String> channelIds = new HashSet<String>(Arrays.asList(channelId1, channelId2));
        final HelloMessage firstHello = new HelloMessageImpl(uaid, channelIds);
        final HelloResponse firstResponse = server.handleHandshake(firstHello);
        assertThat(firstResponse.getUAID(), equalTo(uaid));
        assertThat(server.hasChannel(uaid, channelId1), is(true));
        assertThat(server.hasChannel(uaid, channelId2), is(true));

        final String channelId3 = UUID.randomUUID().toString();
        final String channelId4 = UUID.randomUUID().toString();
        final Set<String> newChannelIds = new HashSet<String>(Arrays.asList(channelId3, channelId4));
        final HelloMessage nextHello = new HelloMessageImpl(uaid, newChannelIds);
        final HelloResponse secondResponse = server.handleHandshake(nextHello);
        assertThat(secondResponse.getUAID(), equalTo(uaid));
        assertThat(server.hasChannel(uaid, channelId1), is(false));
        assertThat(server.hasChannel(uaid, channelId2), is(false));
        assertThat(server.hasChannel(uaid, channelId3), is(true));
        assertThat(server.hasChannel(uaid, channelId4), is(true));
    }
View Full Code Here

    @Test
    public void handleHandshakeWithChannelsButNoUaid() {
        final Set<String> channelIds = new HashSet<String>(Arrays.asList("channel1", "channel2"));
        final HelloMessage handshakeImpl = new HelloMessageImpl(null, channelIds);
        final HelloResponse response = server.handleHandshake(handshakeImpl);
        assertThat(response.getUAID(), is(notNullValue()));
        assertThat(server.hasChannel(handshakeImpl.getUAID(), "channel1"), is(false));
        assertThat(server.hasChannel(handshakeImpl.getUAID(), "channel2"), is(false));
    }
View Full Code Here

    public void websocketHello() {
        final EmbeddedChannel channel = createWebSocketChannel(factory);
        final String uaid = UUIDUtil.newUAID();
        sendWebSocketHttpUpgradeRequest(sessionUrl, channel);

        final HelloResponse response = sendWebSocketHelloFrame(uaid, channel);
        assertThat(response.getMessageType(), equalTo(MessageType.Type.HELLO));
        assertThat(response.getUAID(), equalTo(uaid));
        channel.close();
    }
View Full Code Here

TOP

Related Classes of org.jboss.aerogear.simplepush.protocol.HelloResponse

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.