testUpgradeRejected() — netty Function Reference
Architecture documentation for the testUpgradeRejected() function in HttpClientUpgradeHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 55961b11_ef97_7b29_241e_fa223d59f74b["testUpgradeRejected()"] 64e7cef3_ca61_31ce_7834_0d1da2dc4960["HttpClientUpgradeHandlerTest"] 55961b11_ef97_7b29_241e_fa223d59f74b -->|defined in| 64e7cef3_ca61_31ce_7834_0d1da2dc4960 style 55961b11_ef97_7b29_241e_fa223d59f74b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerTest.java lines 130–165
@Test
public void testUpgradeRejected() {
HttpClientUpgradeHandler.SourceCodec sourceCodec = new FakeSourceCodec();
HttpClientUpgradeHandler.UpgradeCodec upgradeCodec = new FakeUpgradeCodec();
HttpClientUpgradeHandler handler = new HttpClientUpgradeHandler(sourceCodec, upgradeCodec, 1024);
UserEventCatcher catcher = new UserEventCatcher();
EmbeddedChannel channel = new EmbeddedChannel(catcher);
channel.pipeline().addFirst("upgrade", handler);
assertTrue(
channel.writeOutbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "netty.io")));
FullHttpRequest request = channel.readOutbound();
assertEquals(2, request.headers().size());
assertTrue(request.headers().contains(HttpHeaderNames.UPGRADE, "fancyhttp", false));
assertTrue(request.headers().contains("connection", "upgrade", false));
assertTrue(request.release());
assertEquals(HttpClientUpgradeHandler.UpgradeEvent.UPGRADE_ISSUED, catcher.getUserEvent());
HttpResponse upgradeResponse =
new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.SWITCHING_PROTOCOLS);
upgradeResponse.headers().add(HttpHeaderNames.UPGRADE, "fancyhttp");
assertTrue(channel.writeInbound(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)));
assertTrue(channel.writeInbound(LastHttpContent.EMPTY_LAST_CONTENT));
assertEquals(HttpClientUpgradeHandler.UpgradeEvent.UPGRADE_REJECTED, catcher.getUserEvent());
assertNull(channel.pipeline().get("upgrade"));
HttpResponse response = channel.readInbound();
assertEquals(HttpResponseStatus.OK, response.status());
LastHttpContent last = channel.readInbound();
assertEquals(LastHttpContent.EMPTY_LAST_CONTENT, last);
assertFalse(last.release());
assertFalse(channel.finish());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testUpgradeRejected() do?
testUpgradeRejected() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerTest.java.
Where is testUpgradeRejected() defined?
testUpgradeRejected() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerTest.java at line 130.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free