testDecodesFinalResponseAfterSwitchingProtocols() — netty Function Reference
Architecture documentation for the testDecodesFinalResponseAfterSwitchingProtocols() function in HttpClientCodecTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD cc9a8227_cd53_e794_15ee_882aa10dd6be["testDecodesFinalResponseAfterSwitchingProtocols()"] c395f8e2_08a9_4e0c_820e_5851189d51c7["HttpClientCodecTest"] cc9a8227_cd53_e794_15ee_882aa10dd6be -->|defined in| c395f8e2_08a9_4e0c_820e_5851189d51c7 style cc9a8227_cd53_e794_15ee_882aa10dd6be fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java lines 281–309
@Test
public void testDecodesFinalResponseAfterSwitchingProtocols() {
String SWITCHING_PROTOCOLS_RESPONSE = "HTTP/1.1 101 Switching Protocols\r\n" +
"Connection: Upgrade\r\n" +
"Upgrade: TLS/1.2, HTTP/1.1\r\n\r\n";
HttpClientCodec codec = new HttpClientCodec(4096, 8192, 8192, true);
EmbeddedChannel ch = new EmbeddedChannel(codec, new HttpObjectAggregator(1024));
HttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "http://localhost/");
request.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE);
request.headers().set(HttpHeaderNames.UPGRADE, "TLS/1.2");
assertTrue(ch.writeOutbound(request), "Channel outbound write failed.");
assertTrue(ch.writeInbound(Unpooled.copiedBuffer(SWITCHING_PROTOCOLS_RESPONSE, CharsetUtil.ISO_8859_1)),
"Channel inbound write failed.");
Object switchingProtocolsResponse = ch.readInbound();
assertNotNull(switchingProtocolsResponse, "No response received");
assertInstanceOf(FullHttpResponse.class, switchingProtocolsResponse);
((FullHttpResponse) switchingProtocolsResponse).release();
assertTrue(ch.writeInbound(Unpooled.copiedBuffer(RESPONSE, CharsetUtil.ISO_8859_1)),
"Channel inbound write failed");
Object finalResponse = ch.readInbound();
assertNotNull(finalResponse, "No response received");
assertInstanceOf(FullHttpResponse.class, finalResponse);
((FullHttpResponse) finalResponse).release();
assertTrue(ch.finishAndReleaseAll(), "Channel finish failed");
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testDecodesFinalResponseAfterSwitchingProtocols() do?
testDecodesFinalResponseAfterSwitchingProtocols() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java.
Where is testDecodesFinalResponseAfterSwitchingProtocols() defined?
testDecodesFinalResponseAfterSwitchingProtocols() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpClientCodecTest.java at line 281.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free