Home / Function/ testChunkedContent() — netty Function Reference

testChunkedContent() — netty Function Reference

Architecture documentation for the testChunkedContent() function in HttpContentEncoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  81ade038_e333_3fc6_444b_d4464efb49ee["testChunkedContent()"]
  992a26d3_2083_aeb8_4785_63c545814355["HttpContentEncoderTest"]
  81ade038_e333_3fc6_444b_d4464efb49ee -->|defined in| 992a26d3_2083_aeb8_4785_63c545814355
  0a866c5b_d089_2acd_5353_fc5ee08af6b5["assertEncodedResponse()"]
  81ade038_e333_3fc6_444b_d4464efb49ee -->|calls| 0a866c5b_d089_2acd_5353_fc5ee08af6b5
  style 81ade038_e333_3fc6_444b_d4464efb49ee fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java lines 92–127

    @Test
    public void testChunkedContent() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new TestEncoder());
        ch.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/"));

        HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
        res.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
        ch.writeOutbound(res);

        assertEncodedResponse(ch);

        ch.writeOutbound(new DefaultHttpContent(Unpooled.wrappedBuffer(new byte[3])));
        ch.writeOutbound(new DefaultHttpContent(Unpooled.wrappedBuffer(new byte[2])));
        ch.writeOutbound(new DefaultLastHttpContent(Unpooled.wrappedBuffer(new byte[1])));

        HttpContent chunk;
        chunk = ch.readOutbound();
        assertEquals("3", chunk.content().toString(CharsetUtil.US_ASCII));
        chunk.release();

        chunk = ch.readOutbound();
        assertEquals("2", chunk.content().toString(CharsetUtil.US_ASCII));
        chunk.release();

        chunk = ch.readOutbound();
        assertEquals("1", chunk.content().toString(CharsetUtil.US_ASCII));
        assertInstanceOf(HttpContent.class, chunk);
        chunk.release();

        chunk = ch.readOutbound();
        assertFalse(chunk.content().isReadable());
        assertInstanceOf(LastHttpContent.class, chunk);
        chunk.release();

        assertNull(ch.readOutbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does testChunkedContent() do?
testChunkedContent() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java.
Where is testChunkedContent() defined?
testChunkedContent() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java at line 92.
What does testChunkedContent() call?
testChunkedContent() calls 1 function(s): assertEncodedResponse.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free