Home / Function/ testFullContentWithContentLength() — netty Function Reference

testFullContentWithContentLength() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3b87bcc8_d4f5_db86_94e0_233cd3057a31["testFullContentWithContentLength()"]
  992a26d3_2083_aeb8_4785_63c545814355["HttpContentEncoderTest"]
  3b87bcc8_d4f5_db86_94e0_233cd3057a31 -->|defined in| 992a26d3_2083_aeb8_4785_63c545814355
  style 3b87bcc8_d4f5_db86_94e0_233cd3057a31 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java lines 170–196

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

        FullHttpResponse fullRes = new DefaultFullHttpResponse(
                HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(new byte[42]));
        fullRes.headers().set(HttpHeaderNames.CONTENT_LENGTH, 42);
        ch.writeOutbound(fullRes);

        HttpResponse res = ch.readOutbound();
        assertThat(res).isNotInstanceOf(HttpContent.class);
        assertNull(res.headers().get(HttpHeaderNames.TRANSFER_ENCODING));
        assertEquals("2", res.headers().get(HttpHeaderNames.CONTENT_LENGTH));
        assertEquals("test", res.headers().get(HttpHeaderNames.CONTENT_ENCODING));

        HttpContent c = ch.readOutbound();
        assertEquals(2, c.content().readableBytes());
        assertEquals("42", c.content().toString(CharsetUtil.US_ASCII));
        c.release();

        LastHttpContent last = ch.readOutbound();
        assertEquals(0, last.content().readableBytes());
        last.release();

        assertNull(ch.readOutbound());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free