testHandshakeForHttpResponseWithoutAggregator() — netty Function Reference
Architecture documentation for the testHandshakeForHttpResponseWithoutAggregator() function in WebSocketClientHandshakerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD a5d3b152_242f_95c8_fb9c_255e4a889559["testHandshakeForHttpResponseWithoutAggregator()"] 2cb6ab9a_d30f_c725_5b7e_5ad8d513e6b9["WebSocketClientHandshakerTest"] a5d3b152_242f_95c8_fb9c_255e4a889559 -->|defined in| 2cb6ab9a_d30f_c725_5b7e_5ad8d513e6b9 style a5d3b152_242f_95c8_fb9c_255e4a889559 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerTest.java lines 478–516
@Test
public void testHandshakeForHttpResponseWithoutAggregator() {
EmbeddedChannel channel = new EmbeddedChannel(new HttpRequestEncoder(), new HttpResponseDecoder());
URI uri = URI.create("ws://localhost:9999/chat");
WebSocketClientHandshaker clientHandshaker = newHandshaker(uri);
FullHttpRequest handshakeRequest = clientHandshaker.newHandshakeRequest();
handshakeRequest.release();
String accept = "";
if (clientHandshaker.version() != WebSocketVersion.V00) {
String acceptSeed = handshakeRequest.headers().get(HttpHeaderNames.SEC_WEBSOCKET_KEY)
+ WEBSOCKET_13_ACCEPT_GUID;
byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));
accept = WebSocketUtil.base64(sha1);
}
HttpResponse response = new DefaultHttpResponse(HttpVersion.HTTP_1_1, SWITCHING_PROTOCOLS);
response.headers()
.set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET)
.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.set(HttpHeaderNames.SEC_WEBSOCKET_ACCEPT, accept);
ChannelFuture handshakeFuture = clientHandshaker.processHandshake(channel, response);
assertFalse(handshakeFuture.isDone());
assertNotNull(channel.pipeline().get("handshaker"));
if (clientHandshaker.version() != WebSocketVersion.V00) {
assertNull(channel.pipeline().get("httpAggregator"));
channel.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT);
} else {
assertNotNull(channel.pipeline().get("httpAggregator"));
channel.writeInbound(new DefaultLastHttpContent(
Unpooled.copiedBuffer("8jKS'y:G*Co,Wxa-", CharsetUtil.US_ASCII)));
}
assertTrue(handshakeFuture.isDone());
assertNull(channel.pipeline().get("handshaker"));
assertFalse(channel.finish());
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does testHandshakeForHttpResponseWithoutAggregator() do?
testHandshakeForHttpResponseWithoutAggregator() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerTest.java.
Where is testHandshakeForHttpResponseWithoutAggregator() defined?
testHandshakeForHttpResponseWithoutAggregator() is defined in codec-http/src/test/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshakerTest.java at line 478.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free