OioEventLoopTest Class — netty Architecture
Architecture documentation for the OioEventLoopTest class in OioEventLoopTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 014786d9_6185_4241_3f9d_b335998e5758["OioEventLoopTest"] dc037dcb_87f2_6729_67de_f4f1983623e3["OioEventLoopTest.java"] 014786d9_6185_4241_3f9d_b335998e5758 -->|defined in| dc037dcb_87f2_6729_67de_f4f1983623e3 6b4900fc_9600_3087_715b_7b5fc25aa68f["testTooManyServerChannels()"] 014786d9_6185_4241_3f9d_b335998e5758 -->|method| 6b4900fc_9600_3087_715b_7b5fc25aa68f 06009fe4_ec47_85ba_f107_ac2fb00423dc["testTooManyClientChannels()"] 014786d9_6185_4241_3f9d_b335998e5758 -->|method| 06009fe4_ec47_85ba_f107_ac2fb00423dc f0c3c5bd_4143_f926_c9ba_887b9f1b7847["testTooManyAcceptedChannels()"] 014786d9_6185_4241_3f9d_b335998e5758 -->|method| f0c3c5bd_4143_f926_c9ba_887b9f1b7847
Relationship Graph
Source Code
transport/src/test/java/io/netty/channel/oio/OioEventLoopTest.java lines 39–116
public class OioEventLoopTest {
@Test
public void testTooManyServerChannels() throws Exception {
EventLoopGroup g = new OioEventLoopGroup(1);
ServerBootstrap b = new ServerBootstrap();
b.channel(OioServerSocketChannel.class);
b.group(g);
b.childHandler(new ChannelInboundHandlerAdapter());
ChannelFuture f1 = b.bind(0);
f1.sync();
ChannelFuture f2 = b.bind(0);
f2.await();
assertInstanceOf(ChannelException.class, f2.cause());
assertThat(f2.cause().getMessage().toLowerCase()).contains("too many channels");
final CountDownLatch notified = new CountDownLatch(1);
f2.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
notified.countDown();
}
});
notified.await();
g.shutdownGracefully();
}
@Test
public void testTooManyClientChannels() throws Exception {
EventLoopGroup g = new OioEventLoopGroup(1);
ServerBootstrap sb = new ServerBootstrap();
sb.channel(OioServerSocketChannel.class);
sb.group(g);
sb.childHandler(new ChannelInboundHandlerAdapter());
ChannelFuture f1 = sb.bind(0);
f1.sync();
Bootstrap cb = new Bootstrap();
cb.channel(OioSocketChannel.class);
cb.group(g);
cb.handler(new ChannelInboundHandlerAdapter());
ChannelFuture f2 = cb.connect(NetUtil.LOCALHOST, ((InetSocketAddress) f1.channel().localAddress()).getPort());
f2.await();
assertInstanceOf(ChannelException.class, f2.cause());
assertThat(f2.cause().getMessage().toLowerCase()).contains("too many channels");
final CountDownLatch notified = new CountDownLatch(1);
f2.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
notified.countDown();
}
});
notified.await();
g.shutdownGracefully();
}
@Test
public void testTooManyAcceptedChannels() throws Exception {
EventLoopGroup g = new OioEventLoopGroup(1);
ServerBootstrap sb = new ServerBootstrap();
sb.channel(OioServerSocketChannel.class);
sb.group(g);
sb.childHandler(new ChannelInboundHandlerAdapter());
ChannelFuture f1 = sb.bind(0);
f1.sync();
Socket s = new Socket(NetUtil.LOCALHOST, ((InetSocketAddress) f1.channel().localAddress()).getPort());
assertEquals(-1, s.getInputStream().read());
s.close();
g.shutdownGracefully();
}
}
Source
Frequently Asked Questions
What is the OioEventLoopTest class?
OioEventLoopTest is a class in the netty codebase, defined in transport/src/test/java/io/netty/channel/oio/OioEventLoopTest.java.
Where is OioEventLoopTest defined?
OioEventLoopTest is defined in transport/src/test/java/io/netty/channel/oio/OioEventLoopTest.java at line 39.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free