testUpgrade() — netty Function Reference
Architecture documentation for the testUpgrade() function in Http2ServerUpgradeCodecTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac["testUpgrade()"] 6d2db9e7_0b7a_7341_c043_d99766aa1a80["Http2ServerUpgradeCodecTest"] 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac -->|defined in| 6d2db9e7_0b7a_7341_c043_d99766aa1a80 c411b311_33ef_716c_dcb8_391cff758ace["testUpgradeToHttp2ConnectionHandler()"] c411b311_33ef_716c_dcb8_391cff758ace -->|calls| 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac 6b6955bc_200a_3021_70af_8eb8026b9ab9["testUpgradeToHttp2FrameCodec()"] 6b6955bc_200a_3021_70af_8eb8026b9ab9 -->|calls| 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac f9a1f3a9_d901_061b_85a7_c7c424cbd6ff["testUpgradeToHttp2MultiplexCodec()"] f9a1f3a9_d901_061b_85a7_c7c424cbd6ff -->|calls| 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac 553833c4_99f3_43a8_377b_50e35f308e70["testUpgradeToHttp2FrameCodecWithMultiplexer()"] 553833c4_99f3_43a8_377b_50e35f308e70 -->|calls| 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac style 61c47b6e_2bab_16be_fa4f_ac99a5ef3cac fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodecTest.java lines 62–103
private static void testUpgrade(Http2ConnectionHandler handler, ChannelHandler multiplexer) {
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.OPTIONS, "*");
request.headers().set(HttpHeaderNames.HOST, "netty.io");
request.headers().set(HttpHeaderNames.CONNECTION, "Upgrade, HTTP2-Settings");
request.headers().set(HttpHeaderNames.UPGRADE, "h2c");
request.headers().set("HTTP2-Settings", "AAMAAABkAAQAAP__");
ServerChannel parent = Mockito.mock(ServerChannel.class);
EmbeddedChannel channel = new EmbeddedChannel(parent, DefaultChannelId.newInstance(), true, false,
new ChannelInboundHandlerAdapter());
ChannelHandlerContext ctx = channel.pipeline().firstContext();
Http2ServerUpgradeCodec codec;
if (multiplexer == null) {
codec = new Http2ServerUpgradeCodec(handler);
} else {
codec = new Http2ServerUpgradeCodec((Http2FrameCodec) handler, multiplexer);
}
assertTrue(codec.prepareUpgradeResponse(ctx, request, new DefaultHttpHeaders()));
codec.upgradeTo(ctx, request);
// Flush the channel to ensure we write out all buffered data
channel.flush();
channel.writeInbound(Http2CodecUtil.connectionPrefaceBuf());
Http2FrameInboundWriter writer = new Http2FrameInboundWriter(channel);
writer.writeInboundSettings(new Http2Settings());
writer.writeInboundRstStream(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID, Http2Error.CANCEL.code());
assertSame(handler, channel.pipeline().remove(handler.getClass()));
assertNull(channel.pipeline().get(handler.getClass()));
assertTrue(channel.finish());
// Check that the preface was send (a.k.a the settings frame)
ByteBuf settingsBuffer = channel.readOutbound();
assertNotNull(settingsBuffer);
settingsBuffer.release();
ByteBuf buf = channel.readOutbound();
assertNotNull(buf);
buf.release();
assertNull(channel.readOutbound());
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does testUpgrade() do?
testUpgrade() is a function in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodecTest.java.
Where is testUpgrade() defined?
testUpgrade() is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodecTest.java at line 62.
What calls testUpgrade()?
testUpgrade() is called by 4 function(s): testUpgradeToHttp2ConnectionHandler, testUpgradeToHttp2FrameCodec, testUpgradeToHttp2FrameCodecWithMultiplexer, testUpgradeToHttp2MultiplexCodec.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free