Package io.netty.handler.codec.http

Examples of io.netty.handler.codec.http.FullHttpResponse.content()


        verifyNotCached(response);

        final String data = "d=%5B%22x%22%5D";
        final FullHttpResponse sendResponse = jsonpSend(sessionUrl + "/jsonp_send", data, echoService);
        assertThat(sendResponse.getStatus(), is(HttpResponseStatus.OK));
        assertThat(sendResponse.content().toString(UTF_8), equalTo("ok"));
        assertThat(sendResponse.headers().get(CONTENT_TYPE), equalTo(Transports.CONTENT_TYPE_PLAIN));
        verifyNotCached(response);

        final FullHttpResponse pollResponse = jsonpRequest(sessionUrl + "/jsonp?c=callback", echoService);
        assertThat(pollResponse.getStatus(), is(HttpResponseStatus.OK));
View Full Code Here


        verifyNotCached(response);

        final FullHttpResponse pollResponse = jsonpRequest(sessionUrl + "/jsonp?c=callback", echoService);
        assertThat(pollResponse.getStatus(), is(HttpResponseStatus.OK));
        assertThat(pollResponse.headers().get(CONTENT_TYPE), equalTo(Transports.CONTENT_TYPE_JAVASCRIPT));
        assertThat(pollResponse.content().toString(UTF_8), equalTo("callback(\"a[\\\"x\\\"]\");\r\n"));
        verifyNotCached(pollResponse);
    }

    /*
     * Equivalent to JsonPolling.test_no_callback in sockjs-protocol-0.3.3.py.
View Full Code Here

    @Test
    public void jsonpPollingTestNoCallback() throws Exception {
        final SockJsServiceFactory echoService = echoService();
        final FullHttpResponse response = jsonpRequest("/echo/a/a/jsonp", echoService);
        assertThat(response.getStatus(), is(HttpResponseStatus.INTERNAL_SERVER_ERROR));
        assertThat(response.content().toString(UTF_8), equalTo("\"callback\" parameter required"));
    }

    /*
     * Equivalent to JsonPolling.test_invalid_json in sockjs-protocol-0.3.3.py.
     */
 
View Full Code Here

        final String sessionUrl = serviceName + "/222/" + UUID.randomUUID().toString();
        final SockJsServiceFactory echoService = echoService();

        final FullHttpResponse response = jsonpRequest(sessionUrl + "/jsonp?c=x", echoService);
        assertThat(response.getStatus(), is(HttpResponseStatus.OK));
        assertThat(response.content().toString(UTF_8), equalTo("x(\"o\");\r\n"));

        assertBrokenJSONEncoding(jsonpSend(sessionUrl + "/jsonp_send", "d=%5B%22x", echoService));
        assertPayloadExpected(jsonpSend(sessionUrl + "/jsonp_send", "", echoService));
        assertPayloadExpected(jsonpSend(sessionUrl + "/jsonp_send", "d=", echoService));
        assertPayloadExpected(jsonpSend(sessionUrl + "/jsonp_send", "p=p", echoService));
View Full Code Here

        final FullHttpResponse sendResponse = jsonpSend(sessionUrl + "/jsonp_send", "d=%5B%22b%22%5D", echoService);
        assertThat(sendResponse.getStatus(), is(HttpResponseStatus.OK));

        final FullHttpResponse pollResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", echoService);
        assertThat(pollResponse.getStatus(), is(HttpResponseStatus.OK));
        assertThat(pollResponse.content().toString(UTF_8), equalTo("x(\"a[\\\"b\\\"]\");\r\n"));
    }

    /*
     * Equivalent to JsonPolling.test_content_types in sockjs-protocol-0.3.3.py.
     */
 
View Full Code Here

    public void jsonpPollingTestContentTypes() throws Exception {
        final String serviceName = "/echo";
        final String sessionUrl = serviceName + "/222/" + UUID.randomUUID().toString();
        final SockJsServiceFactory echoService = echoService();
        final FullHttpResponse response = jsonpRequest(sessionUrl + "/jsonp?c=x", echoService);
        assertThat(response.content().toString(UTF_8), equalTo("x(\"o\");\r\n"));

        final String data = "d=%5B%22abc%22%5D";
        final FullHttpResponse sendResponse = jsonpSend(sessionUrl + "/jsonp_send", data, echoService);
        assertThat(sendResponse.getStatus(), is(HttpResponseStatus.OK));
View Full Code Here

        final FullHttpResponse plainResponse = jsonpSend(plainRequest, echoService);
        assertThat(plainResponse.getStatus(), is(HttpResponseStatus.OK));

        final FullHttpResponse pollResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", echoService);
        assertThat(pollResponse.getStatus(), is(HttpResponseStatus.OK));
        assertThat(pollResponse.content().toString(UTF_8), equalTo("x(\"a[\\\"abc\\\",\\\"%61bc\\\"]\");\r\n"));
    }

    /*
     * Equivalent to JsonPolling.test_close in sockjs-protocol-0.3.3.py.
     */
 
View Full Code Here

    public void jsonpPollingTestClose() throws Exception {
        final String serviceName = "/close";
        final String sessionUrl = serviceName + "/222/" + UUID.randomUUID().toString();
        final SockJsServiceFactory service = closeService();
        final FullHttpResponse response = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(response.content().toString(UTF_8), equalTo("x(\"o\");\r\n"));

        final FullHttpResponse firstResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(firstResponse.content().toString(UTF_8), equalTo("x(\"c[3000,\\\"Go away!\\\"]\");\r\n"));

        final FullHttpResponse secondResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
View Full Code Here

        final SockJsServiceFactory service = closeService();
        final FullHttpResponse response = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(response.content().toString(UTF_8), equalTo("x(\"o\");\r\n"));

        final FullHttpResponse firstResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(firstResponse.content().toString(UTF_8), equalTo("x(\"c[3000,\\\"Go away!\\\"]\");\r\n"));

        final FullHttpResponse secondResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(secondResponse.content().toString(UTF_8), equalTo("x(\"c[3000,\\\"Go away!\\\"]\");\r\n"));
    }
View Full Code Here

        final FullHttpResponse firstResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(firstResponse.content().toString(UTF_8), equalTo("x(\"c[3000,\\\"Go away!\\\"]\");\r\n"));

        final FullHttpResponse secondResponse = jsonpRequest(sessionUrl + "/jsonp?c=x", service);
        assertThat(secondResponse.content().toString(UTF_8), equalTo("x(\"c[3000,\\\"Go away!\\\"]\");\r\n"));
    }

    /*
     * Equivalent to JsessionIdCookie.test_basic in sockjs-protocol-0.3.3.py.
     */
 
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.