Home / Function/ testFullContentWithContentLength() — netty Function Reference

testFullContentWithContentLength() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  e132a37e_f108_a95e_9496_c6e09a7e5beb["testFullContentWithContentLength()"]
  32ab04b0_6c83_d4f7_6483_fd304f908331["HttpContentCompressorTest"]
  e132a37e_f108_a95e_9496_c6e09a7e5beb -->|defined in| 32ab04b0_6c83_d4f7_6483_fd304f908331
  bdf032ba_93a9_0f83_122a_c24ea71efa75["release()"]
  e132a37e_f108_a95e_9496_c6e09a7e5beb -->|calls| bdf032ba_93a9_0f83_122a_c24ea71efa75
  style e132a37e_f108_a95e_9496_c6e09a7e5beb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java lines 359–395

    @Test
    public void testFullContentWithContentLength() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new HttpContentCompressor());
        ch.writeInbound(newRequest());

        FullHttpResponse fullRes = new DefaultFullHttpResponse(
                HttpVersion.HTTP_1_1, HttpResponseStatus.OK,
                Unpooled.copiedBuffer("Hello, World", CharsetUtil.US_ASCII));
        fullRes.headers().set(HttpHeaderNames.CONTENT_LENGTH, fullRes.content().readableBytes());
        ch.writeOutbound(fullRes);

        HttpResponse res = ch.readOutbound();
        assertInstanceOf(HttpResponse.class, res);

        assertNull(res.headers().get(HttpHeaderNames.TRANSFER_ENCODING));
        assertEquals("gzip", res.headers().get(HttpHeaderNames.CONTENT_ENCODING));

        long contentLengthHeaderValue = HttpUtil.getContentLength(res);
        long observedLength = 0;

        HttpContent c = ch.readOutbound();
        observedLength += c.content().readableBytes();
        assertEquals("1f8b0800000000000000f248cdc9c9d75108cf2fca4901000000ffff", ByteBufUtil.hexDump(c.content()));
        c.release();

        c = ch.readOutbound();
        observedLength += c.content().readableBytes();
        assertEquals("0300c6865b260c000000", ByteBufUtil.hexDump(c.content()));
        c.release();

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

        assertNull(ch.readOutbound());
        assertEquals(contentLengthHeaderValue, observedLength);
    }

Domain

Subdomains

Calls

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/HttpContentCompressorTest.java.
Where is testFullContentWithContentLength() defined?
testFullContentWithContentLength() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentCompressorTest.java at line 359.
What does testFullContentWithContentLength() call?
testFullContentWithContentLength() calls 1 function(s): release.

Analyze Your Own Codebase

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

Try Supermodel Free