Home / Function/ testRfc6455CodeValidation() — netty Function Reference

testRfc6455CodeValidation() — netty Function Reference

Architecture documentation for the testRfc6455CodeValidation() function in WebSocketCloseStatusTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  bec6a474_3dd9_6328_860c_b6bbbac911ab["testRfc6455CodeValidation()"]
  9dd0947f_9d8a_8a66_d1bc_a867bc02b190["WebSocketCloseStatusTest"]
  bec6a474_3dd9_6328_860c_b6bbbac911ab -->|defined in| 9dd0947f_9d8a_8a66_d1bc_a867bc02b190
  style bec6a474_3dd9_6328_860c_b6bbbac911ab fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketCloseStatusTest.java lines 98–132

    @Test
    public void testRfc6455CodeValidation() {
        // Given
        List<Integer> knownCodes = Arrays.asList(
            NORMAL_CLOSURE.code(),
            ENDPOINT_UNAVAILABLE.code(),
            PROTOCOL_ERROR.code(),
            INVALID_MESSAGE_TYPE.code(),
            INVALID_PAYLOAD_DATA.code(),
            POLICY_VIOLATION.code(),
            MESSAGE_TOO_BIG.code(),
            MANDATORY_EXTENSION.code(),
            INTERNAL_SERVER_ERROR.code(),
            SERVICE_RESTART.code(),
            TRY_AGAIN_LATER.code(),
            BAD_GATEWAY.code()
        );

        SortedSet<Integer> invalidCodes = new TreeSet<Integer>();

        // When
        for (int statusCode = Short.MIN_VALUE; statusCode < Short.MAX_VALUE; statusCode++) {
            if (!isValidStatusCode(statusCode)) {
                invalidCodes.add(statusCode);
            }
        }

        // Then
        assertEquals(0, invalidCodes.first().intValue());
        assertEquals(2999, invalidCodes.last().intValue());
        assertEquals(3000 - validCodes.size(), invalidCodes.size());

        invalidCodes.retainAll(knownCodes);
        assertEquals(invalidCodes, Collections.emptySet());
    }

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free