SuccessTestItem Class — netty Architecture
Architecture documentation for the SuccessTestItem class in ProxyHandlerTest.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD b21cb09d_c534_66cd_b352_0951b3241181["SuccessTestItem"] 8ee69b4d_9955_829a_96d0_8c943277a68d["ProxyHandlerTest.java"] b21cb09d_c534_66cd_b352_0951b3241181 -->|defined in| 8ee69b4d_9955_829a_96d0_8c943277a68d b4995adf_0803_a17f_b450_bb5dcc8cb4ba["SuccessTestItem()"] b21cb09d_c534_66cd_b352_0951b3241181 -->|method| b4995adf_0803_a17f_b450_bb5dcc8cb4ba 26b74f53_a3a5_ba00_86af_2d89e23a79a9["test()"] b21cb09d_c534_66cd_b352_0951b3241181 -->|method| 26b74f53_a3a5_ba00_86af_2d89e23a79a9
Relationship Graph
Source Code
handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java lines 660–722
private static final class SuccessTestItem extends TestItem {
private final int expectedEventCount;
// Probably we need to be more flexible here and as for the configuration map,
// not a single key. But as far as it works for now, I'm leaving the impl.
// as is, in case we need to cover more cases (like, AUTO_CLOSE, TCP_NODELAY etc)
// feel free to replace this boolean with either config or method to setup bootstrap
private final boolean autoRead;
SuccessTestItem(String name,
InetSocketAddress destination,
boolean autoRead,
ChannelHandler... clientHandlers) {
super(name, destination, clientHandlers);
int expectedEventCount = 0;
for (ChannelHandler h: clientHandlers) {
if (h instanceof ProxyHandler) {
expectedEventCount++;
}
}
this.expectedEventCount = expectedEventCount;
this.autoRead = autoRead;
}
@Override
protected void test() throws Exception {
final SuccessTestHandler testHandler = new SuccessTestHandler();
Bootstrap b = new Bootstrap();
b.group(group);
b.channel(NioSocketChannel.class);
b.option(ChannelOption.AUTO_READ, this.autoRead);
b.resolver(NoopAddressResolverGroup.INSTANCE);
b.handler(new ChannelInitializer<SocketChannel>() {
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast(clientHandlers);
p.addLast(new LineBasedFrameDecoder(64));
p.addLast(testHandler);
}
});
boolean finished = b.connect(destination).channel().closeFuture().await(10, TimeUnit.SECONDS);
logger.debug("Received messages: {}", testHandler.received);
if (testHandler.exceptions.isEmpty()) {
logger.debug("No recorded exceptions on the client side.");
} else {
for (Throwable t : testHandler.exceptions) {
logger.debug("Recorded exception on the client side: {}", t);
}
}
assertProxyHandlers(true);
assertArrayEquals(new Object[] { "0", "1", "2", "3" }, testHandler.received.toArray());
assertArrayEquals(EmptyArrays.EMPTY_OBJECTS, testHandler.exceptions.toArray());
assertEquals(expectedEventCount, testHandler.eventCount);
assertTrue(finished);
}
}
Source
Frequently Asked Questions
What is the SuccessTestItem class?
SuccessTestItem is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java.
Where is SuccessTestItem defined?
SuccessTestItem is defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java at line 660.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free