readMustBePendingUntilChannelIsActive() — netty Function Reference
Architecture documentation for the readMustBePendingUntilChannelIsActive() function in SocketChannelNotYetConnectedTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3511d9f4_e083_f8e7_f0f0_5a4f878d632e["readMustBePendingUntilChannelIsActive()"] f870305c_1df5_e1b8_f8dd_b59859696da0["SocketChannelNotYetConnectedTest"] 3511d9f4_e083_f8e7_f0f0_5a4f878d632e -->|defined in| f870305c_1df5_e1b8_f8dd_b59859696da0 style 3511d9f4_e083_f8e7_f0f0_5a4f878d632e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java lines 85–123
@Test
@Timeout(30)
public void readMustBePendingUntilChannelIsActive(TestInfo info) throws Throwable {
run(info, new Runner<Bootstrap>() {
@Override
public void run(Bootstrap bootstrap) throws Throwable {
EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, NioIoHandler.newFactory());
ServerBootstrap sb = new ServerBootstrap().group(group);
Channel serverChannel = sb.childHandler(new ChannelInboundHandlerAdapter() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
ctx.writeAndFlush(Unpooled.copyInt(42));
}
}).channel(NioServerSocketChannel.class).bind(0).sync().channel();
final CountDownLatch readLatch = new CountDownLatch(1);
bootstrap.handler(new ByteToMessageDecoder() {
@Override
public void handlerAdded(ChannelHandlerContext ctx) throws Exception {
assertFalse(ctx.channel().isActive());
ctx.read();
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
assertThat(in.readableBytes()).isLessThanOrEqualTo(Integer.BYTES);
if (in.readableBytes() == Integer.BYTES) {
assertThat(in.readInt()).isEqualTo(42);
readLatch.countDown();
}
}
});
bootstrap.connect(serverChannel.localAddress()).sync();
readLatch.await();
group.shutdownGracefully().await();
}
});
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does readMustBePendingUntilChannelIsActive() do?
readMustBePendingUntilChannelIsActive() is a function in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java.
Where is readMustBePendingUntilChannelIsActive() defined?
readMustBePendingUntilChannelIsActive() is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketChannelNotYetConnectedTest.java at line 85.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free