testHandshakeExceptionWhenInvalidUpgradeHeader() — netty Function Reference
Architecture documentation for the testHandshakeExceptionWhenInvalidUpgradeHeader() function in WebSocketServerHandshaker13Test.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 36f445ca_c719_c6cc_ab52_d29b3109bf77["testHandshakeExceptionWhenInvalidUpgradeHeader()"] b3c12c47_d3a9_1bed_608c_a4b3745e9ee9["WebSocketServerHandshaker13Test"] 36f445ca_c719_c6cc_ab52_d29b3109bf77 -->|defined in| b3c12c47_d3a9_1bed_608c_a4b3745e9ee9 style 36f445ca_c719_c6cc_ab52_d29b3109bf77 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java lines 148–172
@Test
public void testHandshakeExceptionWhenInvalidUpgradeHeader() {
final WebSocketServerHandshaker serverHandshaker = newHandshaker("ws://example.com/chat",
"chat", WebSocketDecoderConfig.DEFAULT);
final FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET,
"ws://example.com/chat");
request.headers()
.set(HttpHeaderNames.HOST, "server.example.com")
.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.set(HttpHeaderNames.UPGRADE, "my_websocket")
.set(HttpHeaderNames.SEC_WEBSOCKET_KEY, "dGhlIHNhbXBsZSBub25jZQ==")
.set(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, "http://example.com")
.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, "chat, superchat")
.set(HttpHeaderNames.SEC_WEBSOCKET_VERSION, "13");
Throwable exception = assertThrows(WebSocketServerHandshakeException.class, new Executable() {
@Override
public void execute() throws Throwable {
serverHandshaker.handshake(null, request, null, null);
}
});
assertEquals("not a WebSocket request: a |Upgrade| header must containing the value 'websocket'",
exception.getMessage());
assertTrue(request.release());
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testHandshakeExceptionWhenInvalidUpgradeHeader() do?
testHandshakeExceptionWhenInvalidUpgradeHeader() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java.
Where is testHandshakeExceptionWhenInvalidUpgradeHeader() defined?
testHandshakeExceptionWhenInvalidUpgradeHeader() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker13Test.java at line 148.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free