Package org.jboss.aerogear.simplepush.protocol.impl

Examples of org.jboss.aerogear.simplepush.protocol.impl.HelloMessageImpl


    @Test
    public void handleHandshakeWithChannels() throws ChannelNotFoundException {
        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 handshakeImpl = new HelloMessageImpl(UUIDUtil.newUAID(), channelIds);
        final HelloResponse response = server.handleHandshake(handshakeImpl);
        assertThat(response.getUAID(), is(notNullValue()));
        assertThat(server.getChannel(channelId1), is(notNullValue()));
        assertThat(server.getChannel(channelId2), is(notNullValue()));
    }
View Full Code Here


    @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

    public void handleHandshakeWithExistingAndEmptyChannelIDsInHello() throws ChannelNotFoundException {
        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

    public void handleHandshakeWithExistingAndNewChannels() throws ChannelNotFoundException {
        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));
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

TOP

Related Classes of org.jboss.aerogear.simplepush.protocol.impl.HelloMessageImpl

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.