Examples of RegisterResponseImpl


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

    public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) {
        final String channelId = register.getChannelId();
        final String endpointToken = generateEndpointToken(uaid, channelId);
        final boolean saved = store.saveChannel(new DefaultChannel(uaid, channelId, endpointToken));
        final Status status = saved ? new StatusImpl(200, "OK") : new StatusImpl(409, "Conflict: channeld [" + channelId + " is already in use");
        return new RegisterResponseImpl(channelId, status, makeEndpointUrl(endpointToken));
    }
View Full Code Here

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

        @Override
        public RegisterResponseImpl deserialize(final JsonParser jp, final DeserializationContext ctxt)
                throws IOException {
            final ObjectCodec oc = jp.getCodec();
            final JsonNode node = oc.readTree(jp);
            return new RegisterResponseImpl(node.get(RegisterMessage.CHANNEL_ID_FIELD).asText(),
                    new StatusImpl(node.get(RegisterResponseImpl.STATUS_FIELD).asInt(), "N/A"),
                    node.get(RegisterResponseImpl.PUSH_ENDPOINT__FIELD).asText());
        }
View Full Code Here

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

            final String channelId = UUID.randomUUID().toString();
            final String register = JsonUtil.toJson(new RegisterMessageImpl(channelId));
            final ChannelFuture registerFuture = ch.writeAndFlush(new TextWebSocketFrame(register));
            registerFuture.sync();
            final TextWebSocketFrame registerFrame = handler.getTextFrame();
            final RegisterResponseImpl registerResponse = JsonUtil.fromJson(registerFrame.text(), RegisterResponseImpl.class);
            assertThat(registerResponse.getMessageType(), equalTo(MessageType.Type.REGISTER));
            assertThat(registerResponse.getChannelId(), equalTo(channelId));

            ch.writeAndFlush(new CloseWebSocketFrame());

            ch.closeFuture().sync();
        } finally {
View Full Code Here

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

        pollXhrHelloMessageResponse(factory, sessionUrl);

        final FullHttpResponse registerChannelIdRequest = sendXhrRegisterChannelIdRequest(factory, sessionUrl, channelId);
        assertThat(registerChannelIdRequest.getStatus(), is(HttpResponseStatus.NO_CONTENT));

        final RegisterResponseImpl registerChannelIdResponse = pollXhrRegisterChannelIdResponse(factory, sessionUrl);
        assertThat(registerChannelIdResponse.getChannelId(), equalTo(channelId));
        assertThat(registerChannelIdResponse.getStatus().getCode(), equalTo(200));
        assertThat(registerChannelIdResponse.getPushEndpoint().startsWith("http://127.0.0.1:7777/update/"), is(true));
    }
View Full Code Here

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

    public RegisterResponse handleRegister(final RegisterMessage register, final String uaid) {
        final String channelId = register.getChannelId();
        final String endpointToken = generateEndpointToken(uaid, channelId);
        final boolean saved = store.saveChannel(new DefaultChannel(uaid, channelId, endpointToken));
        final Status status = saved ? new StatusImpl(200, "OK") : new StatusImpl(409, "Conflict: channeld [" + channelId + " is already in use");
        return new RegisterResponseImpl(channelId, status, makeEndpointUrl(endpointToken));
    }
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.