testSwallowedReadComplete() — netty Function Reference
Architecture documentation for the testSwallowedReadComplete() function in FlowControlHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 47d3ff98_f2b9_57a7_a1d9_80119e195e65["testSwallowedReadComplete()"] 403e241f_d76e_484e_d952_7f7a46681916["FlowControlHandlerTest"] 47d3ff98_f2b9_57a7_a1d9_80119e195e65 -->|defined in| 403e241f_d76e_484e_d952_7f7a46681916 style 47d3ff98_f2b9_57a7_a1d9_80119e195e65 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java lines 540–594
@Test
public void testSwallowedReadComplete() throws Exception {
final long delayMillis = 100;
final Queue<IdleStateEvent> userEvents = new LinkedBlockingQueue<IdleStateEvent>();
final EmbeddedChannel channel = new EmbeddedChannel(false, false,
new FlowControlHandler(),
new IdleStateHandler(delayMillis, 0, 0, MILLISECONDS),
new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) {
ctx.fireChannelActive();
ctx.read();
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) {
ctx.fireChannelRead(msg);
ctx.read();
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) {
ctx.fireChannelReadComplete();
ctx.read();
}
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
if (evt instanceof IdleStateEvent) {
userEvents.add((IdleStateEvent) evt);
}
ctx.fireUserEventTriggered(evt);
}
}
);
channel.config().setAutoRead(false);
assertFalse(channel.config().isAutoRead());
channel.register();
// Reset read timeout by some message
assertTrue(channel.writeInbound(Unpooled.EMPTY_BUFFER));
channel.flushInbound();
assertEquals(Unpooled.EMPTY_BUFFER, channel.readInbound());
// Emulate 'no more messages in NIO channel' on the next read attempt.
channel.flushInbound();
assertNull(channel.readInbound());
Thread.sleep(delayMillis + 20L);
channel.runPendingTasks();
assertEquals(IdleStateEvent.FIRST_READER_IDLE_STATE_EVENT, userEvents.poll());
assertFalse(channel.finish());
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testSwallowedReadComplete() do?
testSwallowedReadComplete() is a function in the netty codebase, defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java.
Where is testSwallowedReadComplete() defined?
testSwallowedReadComplete() is defined in handler/src/test/java/io/netty/handler/flow/FlowControlHandlerTest.java at line 540.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free