testCleanupThrows() — netty Function Reference
Architecture documentation for the testCleanupThrows() function in HttpContentEncoderTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 15d910b4_106e_26df_b113_76a245fcda89["testCleanupThrows()"] 992a26d3_2083_aeb8_4785_63c545814355["HttpContentEncoderTest"] 15d910b4_106e_26df_b113_76a245fcda89 -->|defined in| 992a26d3_2083_aeb8_4785_63c545814355 3e159726_d4de_b803_503c_08f4468c3872["Result()"] 15d910b4_106e_26df_b113_76a245fcda89 -->|calls| 3e159726_d4de_b803_503c_08f4468c3872 style 15d910b4_106e_26df_b113_76a245fcda89 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java lines 398–436
@Test
public void testCleanupThrows() {
HttpContentEncoder encoder = new HttpContentEncoder() {
@Override
protected Result beginEncode(HttpResponse httpResponse, String acceptEncoding) throws Exception {
return new Result("myencoding", new EmbeddedChannel(
new ChannelInboundHandlerAdapter() {
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireExceptionCaught(new EncoderException());
ctx.fireChannelInactive();
}
}));
}
};
final AtomicBoolean channelInactiveCalled = new AtomicBoolean();
final EmbeddedChannel channel = new EmbeddedChannel(encoder, new ChannelInboundHandlerAdapter() {
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
assertTrue(channelInactiveCalled.compareAndSet(false, true));
super.channelInactive(ctx);
}
});
assertTrue(channel.writeInbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/")));
assertTrue(channel.writeOutbound(new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK)));
HttpContent content = new DefaultHttpContent(Unpooled.buffer().writeZero(10));
assertTrue(channel.writeOutbound(content));
assertEquals(1, content.refCnt());
assertThrows(CodecException.class, new Executable() {
@Override
public void execute() {
channel.finishAndReleaseAll();
}
});
assertTrue(channelInactiveCalled.get());
assertEquals(0, content.refCnt());
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does testCleanupThrows() do?
testCleanupThrows() is a function in the netty codebase, defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java.
Where is testCleanupThrows() defined?
testCleanupThrows() is defined in codec-http/src/test/java/io/netty/handler/codec/http/HttpContentEncoderTest.java at line 398.
What does testCleanupThrows() call?
testCleanupThrows() calls 1 function(s): Result.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free