Home / Function/ testWebSocketResponse() — netty Function Reference

testWebSocketResponse() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/HttpResponseDecoderTest.java lines 766–788

    @Test
    public void testWebSocketResponse() {
        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();
        EmbeddedChannel ch = new EmbeddedChannel(new HttpResponseDecoder());
        ch.writeInbound(Unpooled.wrappedBuffer(data));

        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();

        assertFalse(ch.finish());

        assertNull(ch.readInbound());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free