Home / Function/ testWebSocketResponseWithDataFollowing() — netty Function Reference

testWebSocketResponseWithDataFollowing() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 791–824

    @Test
    public void testWebSocketResponseWithDataFollowing() {
        byte[] data = ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n" +
                "Upgrade: WebSocket\r\n" +
                "Connection: Upgrade\r\n" +
                "Sec-WebSocket-Origin: http://localhost:8080\r\n" +
                "Sec-WebSocket-Location: ws://localhost/some/path\r\n" +
                "\r\n" +
                "1234567812345678").getBytes();
        byte[] otherData = {1, 2, 3, 4};

        EmbeddedChannel ch = new EmbeddedChannel(new HttpResponseDecoder());
        ch.writeInbound(Unpooled.copiedBuffer(data, otherData));

        HttpResponse res = ch.readInbound();
        assertSame(HttpVersion.HTTP_1_1, res.protocolVersion());
        assertEquals(HttpResponseStatus.SWITCHING_PROTOCOLS, res.status());
        HttpContent content = ch.readInbound();
        assertEquals(16, content.content().readableBytes());
        content.release();

        assertTrue(ch.finish());

        ByteBuf expected = Unpooled.wrappedBuffer(otherData);
        ByteBuf buffer = ch.readInbound();
        try {
            assertEquals(expected, buffer);
        } finally {
            expected.release();
            if (buffer != null) {
                buffer.release();
            }
        }
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free