Package io.netty.handler.codec.http

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


        SockJsTestUtil.verifyNoCacheHeaders(response);

        final DefaultHttpContent prelude = ch.readOutbound();
        assertThat(prelude.content().readableBytes(), is(PreludeFrame.CONTENT_SIZE + 1));
        final ByteBuf buf = Unpooled.buffer(PreludeFrame.CONTENT_SIZE + 1);
        prelude.content().readBytes(buf);
        buf.release();

        final DefaultHttpContent openResponse = ch.readOutbound();
        assertThat(openResponse.content().toString(UTF_8), equalTo("o\n"));
View Full Code Here


        final ByteBuf buf = Unpooled.buffer(PreludeFrame.CONTENT_SIZE + 1);
        prelude.content().readBytes(buf);
        buf.release();

        final DefaultHttpContent openResponse = ch.readOutbound();
        assertThat(openResponse.content().toString(UTF_8), equalTo("o\n"));

        final String msg = generateMessage(128);
        for (int i = 0; i < 31; i++) {
            final FullHttpResponse validSend = xhrSendRequest(sessionUrl, "[\"" + msg + "\"]", echoFactory);
            assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));
View Full Code Here

        final String msg = generateMessage(128);
        for (int i = 0; i < 31; i++) {
            final FullHttpResponse validSend = xhrSendRequest(sessionUrl, "[\"" + msg + "\"]", echoFactory);
            assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));
            final DefaultHttpContent chunk = ch.readOutbound();
            assertThat(chunk.content().toString(UTF_8), equalTo("a[\"" + msg + "\"]\n"));
        }
        final LastHttpContent lastChunk = ch.readOutbound();
        assertThat(lastChunk.content().readableBytes(), is(0));
        assertThat(ch.isOpen(), is(false));
    }
View Full Code Here

        final HttpResponse response =  ch.readOutbound();
        assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK));
        assertThat(response.headers().get(CONTENT_TYPE), equalTo(EventSourceTransport.CONTENT_TYPE_EVENT_STREAM));

        final DefaultHttpContent newLinePrelude = ch.readOutbound();
        assertThat(newLinePrelude.content().toString(UTF_8), equalTo("\r\n"));

        final DefaultHttpContent data = ch.readOutbound();
        assertThat(data.content().toString(UTF_8), equalTo("data: o\r\n\r\n"));

        final String msg = generateMessage(4096);
View Full Code Here

        final DefaultHttpContent newLinePrelude = ch.readOutbound();
        assertThat(newLinePrelude.content().toString(UTF_8), equalTo("\r\n"));

        final DefaultHttpContent data = ch.readOutbound();
        assertThat(data.content().toString(UTF_8), equalTo("data: o\r\n\r\n"));

        final String msg = generateMessage(4096);
        final FullHttpResponse validSend = xhrSendRequest(sessionUrl, "[\"" + msg + "\"]", echoFactory);
        assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));
        final DefaultHttpContent chunk = ch.readOutbound();
View Full Code Here

        final String msg = generateMessage(4096);
        final FullHttpResponse validSend = xhrSendRequest(sessionUrl, "[\"" + msg + "\"]", echoFactory);
        assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));
        final DefaultHttpContent chunk = ch.readOutbound();
        assertThat(chunk.content().toString(UTF_8), equalTo("data: a[\"" + msg + "\"]\r\n\r\n"));

        assertThat(ch.isOpen(), is(false));
    }

    /*
 
View Full Code Here

        final HttpResponse response =  ch.readOutbound();
        assertThat(response.getStatus(), equalTo(HttpResponseStatus.OK));
        assertThat(response.headers().get(CONTENT_TYPE), equalTo(EventSourceTransport.CONTENT_TYPE_EVENT_STREAM));

        final DefaultHttpContent newLinePrelude = ch.readOutbound();
        assertThat(newLinePrelude.content().toString(UTF_8), equalTo("\r\n"));

        final DefaultHttpContent data = ch.readOutbound();
        assertThat(data.content().toString(UTF_8), equalTo("data: o\r\n\r\n"));

        final String msg = "[\"  \\u0000\\n\\r \"]";
View Full Code Here

        final DefaultHttpContent newLinePrelude = ch.readOutbound();
        assertThat(newLinePrelude.content().toString(UTF_8), equalTo("\r\n"));

        final DefaultHttpContent data = ch.readOutbound();
        assertThat(data.content().toString(UTF_8), equalTo("data: o\r\n\r\n"));

        final String msg = "[\"  \\u0000\\n\\r \"]";
        final FullHttpResponse validSend = xhrSendRequest(sessionUrl, msg, echoFactory);
        assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));
View Full Code Here

        final String msg = "[\"  \\u0000\\n\\r \"]";
        final FullHttpResponse validSend = xhrSendRequest(sessionUrl, msg, echoFactory);
        assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));

        final DefaultHttpContent chunk = ch.readOutbound();
        assertThat(chunk.content().toString(UTF_8), equalTo("data: a[\"  \\u0000\\n\\r \"]\r\n\r\n"));
    }

    /*
     * Equivalent to HtmlFile.test_transport in sockjs-protocol-0.3.3.py.
     */
 
View Full Code Here

        final FullHttpResponse validSend = xhrSendRequest(sessionUrl, "[\"x\"]", service);
        assertThat(validSend.getStatus(), is(HttpResponseStatus.NO_CONTENT));

        final DefaultHttpContent messageChunk = ch.readOutbound();
        assertThat(messageChunk.content().toString(UTF_8), equalTo("<script>\np(\"a[\\\"x\\\"]\");\n</script>\r\n"));
        ch.finish();
    }

    /*
     * Equivalent to HtmlFile.test_no_callback 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.