Home / Function/ test100Continue() — netty Function Reference

test100Continue() — netty Function Reference

Architecture documentation for the test100Continue() function in HttpServerCodecTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bf5e8220_1666_227f_772a_4d472ea73757["test100Continue()"]
  b6cdc8d3_b482_5921_941d_6401914d1c4f["HttpServerCodecTest"]
  bf5e8220_1666_227f_772a_4d472ea73757 -->|defined in| b6cdc8d3_b482_5921_941d_6401914d1c4f
  style bf5e8220_1666_227f_772a_4d472ea73757 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpServerCodecTest.java lines 71–118

    @Test
    public void test100Continue() throws Exception {
        EmbeddedChannel ch = new EmbeddedChannel(new HttpServerCodec(), new HttpObjectAggregator(1024));

        // Send the request headers.
        ch.writeInbound(Unpooled.copiedBuffer(
                "PUT /upload-large HTTP/1.1\r\n" +
                "Expect: 100-continue\r\n" +
                "Content-Length: 1\r\n\r\n", CharsetUtil.UTF_8));

        // Ensure the aggregator generates nothing.
        assertNull(ch.readInbound());

        // Ensure the aggregator writes a 100 Continue response.
        ByteBuf continueResponse = ch.readOutbound();
        assertEquals("HTTP/1.1 100 Continue\r\n\r\n", continueResponse.toString(CharsetUtil.UTF_8));
        continueResponse.release();

        // But nothing more.
        assertNull(ch.readOutbound());

        // Send the content of the request.
        ch.writeInbound(Unpooled.wrappedBuffer(new byte[] { 42 }));

        // Ensure the aggregator generates a full request.
        FullHttpRequest req = ch.readInbound();
        assertEquals("1", req.headers().get(HttpHeaderNames.CONTENT_LENGTH));
        assertEquals(1, req.content().readableBytes());
        assertEquals((byte) 42, req.content().readByte());
        req.release();

        // But nothing more.
        assertNull(ch.readInbound());

        // Send the actual response.
        FullHttpResponse res = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.CREATED);
        res.content().writeBytes("OK".getBytes(CharsetUtil.UTF_8));
        res.headers().setInt(HttpHeaderNames.CONTENT_LENGTH, 2);
        ch.writeOutbound(res);

        // Ensure the encoder handles the response after handling 100 Continue.
        ByteBuf encodedRes = ch.readOutbound();
        assertEquals("HTTP/1.1 201 Created\r\n" + HttpHeaderNames.CONTENT_LENGTH + ": 2\r\n\r\nOK",
                encodedRes.toString(CharsetUtil.UTF_8));
        encodedRes.release();

        ch.finish();
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free