Http2MultiplexClientUpgradeTest Class — netty Architecture
Architecture documentation for the Http2MultiplexClientUpgradeTest class in Http2MultiplexClientUpgradeTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e84355c5_9733_4b97_b606_02dd7b61b869["Http2MultiplexClientUpgradeTest"] 69c421b0_c1bc_4be4_2821_dd870a92fcd7["Http2MultiplexClientUpgradeTest.java"] e84355c5_9733_4b97_b606_02dd7b61b869 -->|defined in| 69c421b0_c1bc_4be4_2821_dd870a92fcd7 f365f19d_5f44_eab1_7a34_ef96c13ebaf3["C()"] e84355c5_9733_4b97_b606_02dd7b61b869 -->|method| f365f19d_5f44_eab1_7a34_ef96c13ebaf3 33073bdf_dc12_309b_bed9_712e5237cce6["ChannelHandler()"] e84355c5_9733_4b97_b606_02dd7b61b869 -->|method| 33073bdf_dc12_309b_bed9_712e5237cce6 c61774d3_7923_e8ff_f42b_e13be660735e["upgradeHandlerGetsActivated()"] e84355c5_9733_4b97_b606_02dd7b61b869 -->|method| c61774d3_7923_e8ff_f42b_e13be660735e cc66d897_65f5_07ed_a181_c3df1a30a909["clientUpgradeWithoutUpgradeHandlerThrowsHttp2Exception()"] e84355c5_9733_4b97_b606_02dd7b61b869 -->|method| cc66d897_65f5_07ed_a181_c3df1a30a909
Relationship Graph
Source Code
codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexClientUpgradeTest.java lines 30–96
public abstract class Http2MultiplexClientUpgradeTest<C extends Http2FrameCodec> {
@ChannelHandler.Sharable
static final class NoopHandler extends ChannelInboundHandlerAdapter {
@Override
public void channelActive(ChannelHandlerContext ctx) {
ctx.channel().close();
}
}
private static final class UpgradeHandler extends ChannelInboundHandlerAdapter {
Http2Stream.State stateOnActive;
int streamId;
boolean channelInactiveCalled;
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
Http2StreamChannel ch = (Http2StreamChannel) ctx.channel();
stateOnActive = ch.stream().state();
streamId = ch.stream().id();
super.channelActive(ctx);
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
channelInactiveCalled = true;
super.channelInactive(ctx);
}
}
protected abstract C newCodec(ChannelHandler upgradeHandler);
protected abstract ChannelHandler newMultiplexer(ChannelHandler upgradeHandler);
@Test
public void upgradeHandlerGetsActivated() throws Exception {
UpgradeHandler upgradeHandler = new UpgradeHandler();
C codec = newCodec(upgradeHandler);
EmbeddedChannel ch = new EmbeddedChannel(codec, newMultiplexer(upgradeHandler));
codec.onHttpClientUpgrade();
assertFalse(upgradeHandler.stateOnActive.localSideOpen());
assertTrue(upgradeHandler.stateOnActive.remoteSideOpen());
assertNotNull(codec.connection().stream(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID).getProperty(codec.streamKey));
assertEquals(Http2CodecUtil.HTTP_UPGRADE_STREAM_ID, upgradeHandler.streamId);
assertTrue(ch.finishAndReleaseAll());
assertTrue(upgradeHandler.channelInactiveCalled);
}
@Test
public void clientUpgradeWithoutUpgradeHandlerThrowsHttp2Exception() throws Http2Exception {
final C codec = newCodec(null);
final EmbeddedChannel ch = new EmbeddedChannel(codec, newMultiplexer(null));
assertThrows(Http2Exception.class, new Executable() {
@Override
public void execute() throws Http2Exception {
try {
codec.onHttpClientUpgrade();
} finally {
ch.finishAndReleaseAll();
}
}
});
}
}
Defined In
Source
Frequently Asked Questions
What is the Http2MultiplexClientUpgradeTest class?
Http2MultiplexClientUpgradeTest is a class in the netty codebase, defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexClientUpgradeTest.java.
Where is Http2MultiplexClientUpgradeTest defined?
Http2MultiplexClientUpgradeTest is defined in codec-http2/src/test/java/io/netty/handler/codec/http2/Http2MultiplexClientUpgradeTest.java at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free