Examples of HelloMessageImpl


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

                final MessageType messageType = JsonUtil.parseFrame(buffer.toString());
                switch (messageType.getMessageType()) {
                    case HELLO:
                        HelloMessage handshakeMessage = fromJson(buffer.toString(), HelloMessageImpl.class);
                        if (!writeHandlerMap.containsKey(handshakeMessage.getUAID())) {
                            handshakeMessage = new HelloMessageImpl(UUIDUtil.newUAID());
                        }
                        final HelloResponse helloResponse = simplePushServer.handleHandshake(handshakeMessage);
                        sock.write(new Buffer(toJson(helloResponse)));
                        uaid = helloResponse.getUAID();
                        writeHandlerMap.put(uaid.toString(), sock.writeHandlerID());
View Full Code Here

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

                    channelIds.add(channelIdNode.asText());
                }
            }
            final JsonNode uaid = node.get(HelloMessage.UAID_FIELD);
            if (uaid != null) {
                return new HelloMessageImpl(node.get(HelloMessage.UAID_FIELD).asText(), channelIds);
            } else {
                return new HelloMessageImpl();
            }
        }
View Full Code Here

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

            final Channel ch = b.connect(uri.getHost(), uri.getPort()).sync().channel();
            handler.handshakeFuture().sync();

            final String uaid = UUIDUtil.newUAID();
            final String json = JsonUtil.toJson(new HelloMessageImpl(uaid.toString()));
            final ChannelFuture future = ch.writeAndFlush(new TextWebSocketFrame(json));
            future.sync();
            final TextWebSocketFrame textFrame = handler.getTextFrame();
            final HelloResponse fromJson = JsonUtil.fromJson(textFrame.text(), HelloResponseImpl.class);
            assertThat(fromJson.getMessageType(), equalTo(MessageType.Type.HELLO));
View Full Code Here

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

            final Channel ch = b.connect(uri.getHost(), uri.getPort()).sync().channel();
            handler.handshakeFuture().sync();

            final String uaid = UUIDUtil.newUAID();
            final String json = JsonUtil.toJson(new HelloMessageImpl(uaid.toString()));
            final ChannelFuture future = ch.writeAndFlush(new TextWebSocketFrame(json));
            future.sync();
            final TextWebSocketFrame textFrame = handler.getTextFrame();
            final HelloResponse fromJson = JsonUtil.fromJson(textFrame.text(), HelloResponseImpl.class);
            assertThat(fromJson.getMessageType(), equalTo(MessageType.Type.HELLO));
View Full Code Here

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

        when(sessionContext.getContext()).thenReturn(ctx);
        return sessionContext;
    }

    private void doRegister(final String uaid, final SimplePushServer server) {
        server.handleHandshake(new HelloMessageImpl(uaid.toString()));
        server.handleRegister(new RegisterMessageImpl(uaid.toString()), uaid);

    }
View Full Code Here

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

    private TestUtil() {
    }

    public static String helloFrameAsJson(final String uaid, final String... channelIds) {
        return toJson(new HelloMessageImpl(uaid.toString(), new HashSet<String>(Arrays.asList(channelIds))));
    }
View Full Code Here

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

        server = new DefaultSimplePushServer(dataStore, config, privateKey);
    }

    @Test
    public void handleHandshake() {
        final HelloResponse response = server.handleHandshake(new HelloMessageImpl());
        assertThat(response.getUAID(), is(notNullValue()));
    }
View Full Code Here

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

        assertThat(response.getUAID(), is(notNullValue()));
    }

    @Test
    public void handleHandshakeWithNullUaid() {
        final HelloResponse response = server.handleHandshake(new HelloMessageImpl(null));
        assertThat(response.getUAID(), is(notNullValue()));
    }
View Full Code Here

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

    }

    @Test
    public void handleHandshakeWithExistingUaid() {
        final String uaid = UUIDUtil.newUAID();
        final HelloResponse response = server.handleHandshake(new HelloMessageImpl(uaid));
        assertThat(response.getUAID(), equalTo(uaid));
    }
View Full Code Here

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

    }

    @Test
    public void handleHandshakeWithInvalidUaid() {
        final String uaid = "bajja11122";
        final HelloResponse response = server.handleHandshake(new HelloMessageImpl(uaid));
        assertThat(response.getUAID(), is(notNullValue()));
    }
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.