Home / Function/ testPerformOpeningHandshake0() — netty Function Reference

testPerformOpeningHandshake0() — netty Function Reference

Architecture documentation for the testPerformOpeningHandshake0() function in WebSocketServerHandshaker00Test.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  900ad118_c21d_71b7_c011_4971f0972efb["testPerformOpeningHandshake0()"]
  d374dcfe_f835_e4de_40de_2a57e6bb4779["WebSocketServerHandshaker00Test"]
  900ad118_c21d_71b7_c011_4971f0972efb -->|defined in| d374dcfe_f835_e4de_40de_2a57e6bb4779
  aaaca005_d141_0f10_1fcc_522dea1ac171["testPerformOpeningHandshake()"]
  aaaca005_d141_0f10_1fcc_522dea1ac171 -->|calls| 900ad118_c21d_71b7_c011_4971f0972efb
  3adfbbc6_96b6_4698_9d07_3015145777e8["testPerformOpeningHandshakeSubProtocolNotSupported()"]
  3adfbbc6_96b6_4698_9d07_3015145777e8 -->|calls| 900ad118_c21d_71b7_c011_4971f0972efb
  style 900ad118_c21d_71b7_c011_4971f0972efb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00Test.java lines 91–130

    private static void testPerformOpeningHandshake0(boolean subProtocol) {
        EmbeddedChannel ch = new EmbeddedChannel(
                new HttpObjectAggregator(42), new HttpRequestDecoder(), new HttpResponseEncoder());

        FullHttpRequest req = new DefaultFullHttpRequest(
                HTTP_1_1, HttpMethod.GET, "/chat", Unpooled.copiedBuffer("^n:ds[4U", CharsetUtil.US_ASCII));

        req.headers().set(HttpHeaderNames.HOST, "server.example.com");
        req.headers().set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET);
        req.headers().set(HttpHeaderNames.CONNECTION, "Upgrade");
        req.headers().set(HttpHeaderNames.ORIGIN, "http://example.com");
        req.headers().set(HttpHeaderNames.SEC_WEBSOCKET_KEY1, "4 @1  46546xW%0l 1 5");
        req.headers().set(HttpHeaderNames.SEC_WEBSOCKET_KEY2, "12998 5 Y3 1  .P00");
        req.headers().set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, "chat, superchat");

        if (subProtocol) {
            new WebSocketServerHandshaker00(
                    "ws://example.com/chat", "chat", Integer.MAX_VALUE).handshake(ch, req);
        } else {
            new WebSocketServerHandshaker00(
                    "ws://example.com/chat", null, Integer.MAX_VALUE).handshake(ch, req);
        }

        EmbeddedChannel ch2 = new EmbeddedChannel(new HttpResponseDecoder());
        ch2.writeInbound(ch.<ByteBuf>readOutbound());
        HttpResponse res = ch2.readInbound();

        assertEquals("ws://example.com/chat", res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_LOCATION));

        if (subProtocol) {
            assertEquals("chat", res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
        } else {
            assertNull(res.headers().get(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL));
        }
        LastHttpContent content = ch2.readInbound();

        assertEquals("8jKS'y:G*Co,Wxa-", content.content().toString(CharsetUtil.US_ASCII));
        content.release();
        req.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testPerformOpeningHandshake0() do?
testPerformOpeningHandshake0() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00Test.java.
Where is testPerformOpeningHandshake0() defined?
testPerformOpeningHandshake0() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker00Test.java at line 91.
What calls testPerformOpeningHandshake0()?
testPerformOpeningHandshake0() is called by 2 function(s): testPerformOpeningHandshake, testPerformOpeningHandshakeSubProtocolNotSupported.

Analyze Your Own Codebase

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

Try Supermodel Free