Home / Function/ testResponseChunkedExceedMaxChunkSize() — netty Function Reference

testResponseChunkedExceedMaxChunkSize() — netty Function Reference

Architecture documentation for the testResponseChunkedExceedMaxChunkSize() function in HttpResponseDecoderTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  b40beb75_d915_1036_286d_c59da379c5e7["testResponseChunkedExceedMaxChunkSize()"]
  90546a8c_51c4_a9dc_b6e8_695d29269596["HttpResponseDecoderTest"]
  b40beb75_d915_1036_286d_c59da379c5e7 -->|defined in| 90546a8c_51c4_a9dc_b6e8_695d29269596
  style b40beb75_d915_1036_286d_c59da379c5e7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 343–390

    @Test
    public void testResponseChunkedExceedMaxChunkSize() {
        EmbeddedChannel ch = new EmbeddedChannel(new HttpResponseDecoder(4096, 8192, 32));
        ch.writeInbound(
                Unpooled.copiedBuffer("HTTP/1.1 200 OK\r\nTransfer-Encoding: chunked\r\n\r\n", CharsetUtil.US_ASCII));

        HttpResponse res = ch.readInbound();
        assertSame(HttpVersion.HTTP_1_1, res.protocolVersion());
        assertEquals(HttpResponseStatus.OK, res.status());

        byte[] data = new byte[64];
        for (int i = 0; i < data.length; i++) {
            data[i] = (byte) i;
        }

        for (int i = 0; i < 10; i++) {
            assertFalse(ch.writeInbound(Unpooled.copiedBuffer(Integer.toHexString(data.length) + "\r\n",
                    CharsetUtil.US_ASCII)));
            assertTrue(ch.writeInbound(Unpooled.copiedBuffer(data)));

            byte[] decodedData = new byte[data.length];
            HttpContent content = ch.readInbound();
            assertEquals(32, content.content().readableBytes());
            content.content().readBytes(decodedData, 0, 32);
            content.release();

            content = ch.readInbound();
            assertEquals(32, content.content().readableBytes());

            content.content().readBytes(decodedData, 32, 32);

            assertArrayEquals(data, decodedData);
            content.release();

            assertFalse(ch.writeInbound(Unpooled.copiedBuffer("\r\n", CharsetUtil.US_ASCII)));
        }

        // Write the last chunk.
        ch.writeInbound(Unpooled.copiedBuffer("0\r\n\r\n", CharsetUtil.US_ASCII));

        // Ensure the last chunk was decoded.
        LastHttpContent content = ch.readInbound();
        assertFalse(content.content().isReadable());
        content.release();

        ch.finish();
        assertNull(ch.readInbound());
    }

Domain

Subdomains

Frequently Asked Questions

What does testResponseChunkedExceedMaxChunkSize() do?
testResponseChunkedExceedMaxChunkSize() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java.
Where is testResponseChunkedExceedMaxChunkSize() defined?
testResponseChunkedExceedMaxChunkSize() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java at line 343.

Analyze Your Own Codebase

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

Try Supermodel Free