Home / Class/ WebSocketHandshakeExceptionTest Class — netty Architecture

WebSocketHandshakeExceptionTest Class — netty Architecture

Architecture documentation for the WebSocketHandshakeExceptionTest class in WebSocketHandshakeExceptionTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  2b19c4fa_b917_c100_40ae_46384c31b5fd["WebSocketHandshakeExceptionTest"]
  7701ed72_e098_26f3_474e_e07178a832a4["WebSocketHandshakeExceptionTest.java"]
  2b19c4fa_b917_c100_40ae_46384c31b5fd -->|defined in| 7701ed72_e098_26f3_474e_e07178a832a4
  c54ebf84_0255_e668_3b89_71e310c4f548["testClientExceptionWithoutResponse()"]
  2b19c4fa_b917_c100_40ae_46384c31b5fd -->|method| c54ebf84_0255_e668_3b89_71e310c4f548
  9ce86adf_651a_4da8_5112_af6a28c979db["testClientExceptionWithResponse()"]
  2b19c4fa_b917_c100_40ae_46384c31b5fd -->|method| 9ce86adf_651a_4da8_5112_af6a28c979db
  8d230de0_7bc6_4bac_4862_64803ec7f3e7["testServerExceptionWithoutRequest()"]
  2b19c4fa_b917_c100_40ae_46384c31b5fd -->|method| 8d230de0_7bc6_4bac_4862_64803ec7f3e7
  ff22bf37_ed79_23dc_35ea_61a581fa4e6c["testClientExceptionWithRequest()"]
  2b19c4fa_b917_c100_40ae_46384c31b5fd -->|method| ff22bf37_ed79_23dc_35ea_61a581fa4e6c

Relationship Graph

Source Code

codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketHandshakeExceptionTest.java lines 31–76

public class WebSocketHandshakeExceptionTest {

    @Test
    public void testClientExceptionWithoutResponse() {
        WebSocketClientHandshakeException clientException = new WebSocketClientHandshakeException("client message");

        assertNull(clientException.response());
        assertEquals("client message", clientException.getMessage());
    }

    @Test
    public void testClientExceptionWithResponse() {
        HttpResponse httpResponse = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.BAD_REQUEST);
        httpResponse.headers().set("x-header", "x-value");
        WebSocketClientHandshakeException clientException = new WebSocketClientHandshakeException("client message",
                                                                                                  httpResponse);

        assertNotNull(clientException.response());
        assertEquals("client message", clientException.getMessage());
        assertEquals(HttpResponseStatus.BAD_REQUEST, clientException.response().status());
        assertEquals(httpResponse.headers(), clientException.response().headers());
    }

    @Test
    public void testServerExceptionWithoutRequest() {
        WebSocketServerHandshakeException serverException = new WebSocketServerHandshakeException("server message");

        assertNull(serverException.request());
        assertEquals("server message", serverException.getMessage());
    }

    @Test
    public void testClientExceptionWithRequest() {
        HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
                                                         "ws://localhost:9999/ws");
        httpRequest.headers().set("x-header", "x-value");
        WebSocketServerHandshakeException serverException = new WebSocketServerHandshakeException("server message",
                                                                                                  httpRequest);

        assertNotNull(serverException.request());
        assertEquals("server message", serverException.getMessage());
        assertEquals(HttpMethod.GET, serverException.request().method());
        assertEquals(httpRequest.headers(), serverException.request().headers());
        assertEquals(httpRequest.uri(), serverException.request().uri());
    }
}

Frequently Asked Questions

What is the WebSocketHandshakeExceptionTest class?
WebSocketHandshakeExceptionTest is a class in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketHandshakeExceptionTest.java.
Where is WebSocketHandshakeExceptionTest defined?
WebSocketHandshakeExceptionTest is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketHandshakeExceptionTest.java at line 31.

Analyze Your Own Codebase

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

Try Supermodel Free