testConnectFutureBeforeChannelActive() — netty Function Reference
Architecture documentation for the testConnectFutureBeforeChannelActive() function in LocalChannelTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD ff5e34d2_f3a3_dac4_6df3_0957135445bd["testConnectFutureBeforeChannelActive()"] d7e5442a_9b99_814d_2bd6_0be57237db65["LocalChannelTest"] ff5e34d2_f3a3_dac4_6df3_0957135445bd -->|defined in| d7e5442a_9b99_814d_2bd6_0be57237db65 8088efe8_c29f_fb7e_c0b6_5eeb1a6637f1["channelActive()"] ff5e34d2_f3a3_dac4_6df3_0957135445bd -->|calls| 8088efe8_c29f_fb7e_c0b6_5eeb1a6637f1 d3c8aa54_ac5d_6944_e789_c2c22ce16089["closeChannel()"] ff5e34d2_f3a3_dac4_6df3_0957135445bd -->|calls| d3c8aa54_ac5d_6944_e789_c2c22ce16089 style ff5e34d2_f3a3_dac4_6df3_0957135445bd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/local/LocalChannelTest.java lines 800–850
@Test
@Timeout(value = 3000, unit = TimeUnit.MILLISECONDS)
public void testConnectFutureBeforeChannelActive() throws Exception {
Bootstrap cb = new Bootstrap();
ServerBootstrap sb = new ServerBootstrap();
cb.group(group1)
.channel(LocalChannel.class)
.handler(new ChannelInboundHandlerAdapter());
sb.group(group2)
.channel(LocalServerChannel.class)
.childHandler(new ChannelInitializer<LocalChannel>() {
@Override
public void initChannel(LocalChannel ch) throws Exception {
ch.pipeline().addLast(new TestHandler());
}
});
Channel sc = null;
Channel cc = null;
try {
// Start server
sc = sb.bind(TEST_ADDRESS).sync().channel();
cc = cb.register().sync().channel();
final ChannelPromise promise = cc.newPromise();
final Promise<Void> assertPromise = cc.eventLoop().newPromise();
cc.pipeline().addLast(new TestHandler() {
@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
// Ensure the promise was done before the handler method is triggered.
if (promise.isDone()) {
assertPromise.setSuccess(null);
} else {
assertPromise.setFailure(new AssertionError("connect promise should be done"));
}
}
});
// Connect to the server
cc.connect(sc.localAddress(), promise).sync();
assertPromise.syncUninterruptibly();
assertTrue(promise.isSuccess());
} finally {
closeChannel(cc);
closeChannel(sc);
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does testConnectFutureBeforeChannelActive() do?
testConnectFutureBeforeChannelActive() is a function in the netty codebase, defined in transport/src/test/java/io/netty/channel/local/LocalChannelTest.java.
Where is testConnectFutureBeforeChannelActive() defined?
testConnectFutureBeforeChannelActive() is defined in transport/src/test/java/io/netty/channel/local/LocalChannelTest.java at line 800.
What does testConnectFutureBeforeChannelActive() call?
testConnectFutureBeforeChannelActive() calls 2 function(s): channelActive, closeChannel.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free