Package org.jboss.aerogear.io.netty.handler.codec.sockjs

Examples of org.jboss.aerogear.io.netty.handler.codec.sockjs.SockJsServiceFactory.config()


     * Equivalent to XhrPolling.test_invalid_json sockjs-protocol-0.3.3.py.
     */
    @Test
    public void xhrPollingTestInvalidJson() throws Exception {
        final SockJsServiceFactory echoFactory = echoService();
        final String sessionUrl = echoFactory.config().prefix() + "/abc/" + UUID.randomUUID().toString();

        assertOpenFrameResponse(xhrRequest(sessionUrl, echoFactory));

        final FullHttpResponse xhrSendResponse = xhrSendRequest(sessionUrl, "[\"x\"", echoFactory);
        assertThat(xhrSendResponse.getStatus(), is(HttpResponseStatus.INTERNAL_SERVER_ERROR));
View Full Code Here


     * Equivalent to XhrPolling.test_content_types sockjs-protocol-0.3.3.py.
     */
    @Test
    public void xhrPollingTestContentTypes() throws Exception {
        final SockJsServiceFactory echoFactory = echoService();
        final String sessionUrl = echoFactory.config().prefix() + "/abc/" + UUID.randomUUID().toString();

        final FullHttpResponse response = xhrRequest(sessionUrl, echoFactory);
        assertThat(response.getStatus(), is(HttpResponseStatus.OK));
        assertThat(response.content().toString(UTF_8), equalTo("o\n"));

View Full Code Here

     * Equivalent to XhrPolling.test_request_headers_cors sockjs-protocol-0.3.3.py.
     */
    @Test
    public void xhrPollingTestRequestHeadersCors() throws Exception {
        final SockJsServiceFactory echoFactory = echoService();
        final String sessionUrl = echoFactory.config().prefix() + "/abc/" + UUID.randomUUID().toString();

        final FullHttpRequest okRequest = httpRequest(sessionUrl + "/xhr", POST);
        okRequest.headers().set(ACCESS_CONTROL_REQUEST_HEADERS, "a, b, c");
        final HttpResponse response = xhrRequest(okRequest, echoFactory);
        assertThat(response.getStatus(), is(HttpResponseStatus.OK));
View Full Code Here

        final HttpResponse response = xhrRequest(okRequest, echoFactory);
        assertThat(response.getStatus(), is(HttpResponseStatus.OK));
        SockJsTestUtil.assertCORSHeaders(response, "*");
        assertThat(response.headers().get(ACCESS_CONTROL_ALLOW_HEADERS), equalTo("a, b, c"));

        final String emptySessionUrl = echoFactory.config().prefix() + "/abc/" + UUID.randomUUID().toString();
        final FullHttpRequest emptyHeaderRequest = httpRequest(emptySessionUrl + "/xhr", POST);
        emptyHeaderRequest.headers().set(ACCESS_CONTROL_REQUEST_HEADERS, "");
        final HttpResponse emptyHeaderResponse = xhrRequest(emptyHeaderRequest, echoFactory);
        assertThat(emptyHeaderResponse.getStatus(), is(HttpResponseStatus.OK));
        SockJsTestUtil.assertCORSHeaders(response, "*");
 
View Full Code Here

        final HttpResponse emptyHeaderResponse = xhrRequest(emptyHeaderRequest, echoFactory);
        assertThat(emptyHeaderResponse.getStatus(), is(HttpResponseStatus.OK));
        SockJsTestUtil.assertCORSHeaders(response, "*");
        assertThat(emptyHeaderResponse.headers().get(ACCESS_CONTROL_ALLOW_HEADERS), is(nullValue()));

        final String noHeaderSessionUrl = echoFactory.config().prefix() + "/abc/" + UUID.randomUUID().toString();
        final FullHttpRequest noHeaderRequest = httpRequest(noHeaderSessionUrl + "/xhr", POST);
        final HttpResponse noHeaderResponse = xhrRequest(noHeaderRequest, echoFactory);
        assertThat(noHeaderResponse.getStatus(), is(HttpResponseStatus.OK));
        SockJsTestUtil.assertCORSHeaders(response, "*");
        assertThat(noHeaderResponse.headers().get(ACCESS_CONTROL_ALLOW_HEADERS), is(nullValue()));
View Full Code Here

     * Equivalent to XhrStreaming.test_options in sockjs-protocol-0.3.3.py.
     */
    @Test
    public void xhrStreamingTestOptions() throws Exception {
        final SockJsServiceFactory serviceFactory = echoService();
        final String sessionUrl = serviceFactory.config().prefix() + "/222/" + UUID.randomUUID().toString();
        final EmbeddedChannel ch = channelForService(serviceFactory);
        removeLastInboundMessageHandlers(ch);

        final FullHttpRequest request = httpRequest(sessionUrl + Transports.Type.XHR_STREAMING.path(), GET);
        ch.writeInbound(request);
View Full Code Here

     */
    @Test
    public void xhrStreamingTestResponseLimit() throws Exception {
        final SockJsConfig config = SockJsConfig.withPrefix("/echo").maxStreamingBytesSize(4096).build();
        final SockJsServiceFactory echoFactory = echoService(config);
        final String sessionUrl = echoFactory.config().prefix() + "/222/" + UUID.randomUUID().toString();
        final EmbeddedChannel ch = channelForService(echoFactory);
        removeLastInboundMessageHandlers(ch);

        final FullHttpRequest request = httpRequest(sessionUrl + Transports.Type.XHR_STREAMING.path(), GET);
        ch.writeInbound(request);
View Full Code Here

     */
    @Test
    public void eventSourceTestResponseLimit() throws Exception {
        final SockJsConfig config = SockJsConfig.withPrefix("/echo").maxStreamingBytesSize(4096).build();
        final SockJsServiceFactory echoFactory = echoService(config);
        final String sessionUrl = echoFactory.config().prefix() + "/222/" + UUID.randomUUID().toString();
        final EmbeddedChannel ch = channelForService(echoFactory);
        removeLastInboundMessageHandlers(ch);

        final FullHttpRequest request = httpRequest(sessionUrl + Transports.Type.EVENTSOURCE.path(), GET);
        ch.writeInbound(request);
View Full Code Here

     */
    @Test
    public void eventSourceTestTransport() throws Exception {
        final SockJsConfig config = SockJsConfig.withPrefix("/echo").maxStreamingBytesSize(4096).build();
        final SockJsServiceFactory echoFactory = echoService(config);
        final String sessionUrl = echoFactory.config().prefix() + "/222/" + UUID.randomUUID().toString();
        final EmbeddedChannel ch = channelForService(echoFactory);
        removeLastInboundMessageHandlers(ch);

        final FullHttpRequest request = httpRequest(sessionUrl + Transports.Type.EVENTSOURCE.path(), GET);
        ch.writeInbound(request);
View Full Code Here

     */
    @Test
    public void rawWebsocketTestClose() throws Exception {
        final SockJsServiceFactory closeFactory = closeService();
        final EmbeddedChannel ch = wsChannelForService(closeFactory);
        ch.writeInbound(webSocketUpgradeRequest(closeFactory.config().prefix() + "/websocket"));
        assertThat(ch.isActive(), is(false));
        ch.finish();
    }

    @Test
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.