Package io.netty.handler.codec.http

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


            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));
    }

    /*
     * Equivalent to EventSource.test_response_limit in sockjs-protocol-0.3.3.py.
View Full Code Here


             * the trailing headers.
             * However, we need to increment the ref count of the content so that the assumptions down the line of the
             * ByteBuf always being released by the last pipeline handler will not break (as ServerSentEventDecoder releases
             * the ByteBuf after read).
             */
            lastHttpContent.content().retain(); // pseudo retain so that the last handler of the pipeline can release it.

            if (lastHttpContent.content().isReadable()) {
                ctx.fireChannelRead(lastHttpContent.content());
            }

View Full Code Here

             * ByteBuf always being released by the last pipeline handler will not break (as ServerSentEventDecoder releases
             * the ByteBuf after read).
             */
            lastHttpContent.content().retain(); // pseudo retain so that the last handler of the pipeline can release it.

            if (lastHttpContent.content().isReadable()) {
                ctx.fireChannelRead(lastHttpContent.content());
            }

            ctx.fireChannelRead(msg); // Since the content is already consumed above (by the SSEDecoder), this is just
                                      // as sending just trailing headers. This is critical to mark the end of stream.
View Full Code Here

             * the ByteBuf after read).
             */
            lastHttpContent.content().retain(); // pseudo retain so that the last handler of the pipeline can release it.

            if (lastHttpContent.content().isReadable()) {
                ctx.fireChannelRead(lastHttpContent.content());
            }

            ctx.fireChannelRead(msg); // Since the content is already consumed above (by the SSEDecoder), this is just
                                      // as sending just trailing headers. This is critical to mark the end of stream.

View Full Code Here

        } else {
            Assert.assertNull(res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
        }
        LastHttpContent content = ch2.readInbound();

        Assert.assertEquals("8jKS'y:G*Co,Wxa-", content.content().toString(CharsetUtil.US_ASCII));
        content.release();
    }
}
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.