Home / Class/ FailureTestItem Class — netty Architecture

FailureTestItem Class — netty Architecture

Architecture documentation for the FailureTestItem class in ProxyHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  eabc1d13_7b38_2895_f373_385efd92dbac["FailureTestItem"]
  8ee69b4d_9955_829a_96d0_8c943277a68d["ProxyHandlerTest.java"]
  eabc1d13_7b38_2895_f373_385efd92dbac -->|defined in| 8ee69b4d_9955_829a_96d0_8c943277a68d
  149d12ea_b58d_e515_d43b_6c2e499701fe["FailureTestItem()"]
  eabc1d13_7b38_2895_f373_385efd92dbac -->|method| 149d12ea_b58d_e515_d43b_6c2e499701fe
  4609bb4d_01b0_70fc_f5ab_b05a46b48346["test()"]
  eabc1d13_7b38_2895_f373_385efd92dbac -->|method| 4609bb4d_01b0_70fc_f5ab_b05a46b48346

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java lines 724–764

    private static final class FailureTestItem extends TestItem {

        private final String expectedMessage;

        FailureTestItem(
                String name, InetSocketAddress destination, String expectedMessage, ChannelHandler... clientHandlers) {
            super(name, destination, clientHandlers);
            this.expectedMessage = expectedMessage;
        }

        @Override
        protected void test() throws Exception {
            final FailureTestHandler testHandler = new FailureTestHandler();
            Bootstrap b = new Bootstrap();
            b.group(group);
            b.channel(NioSocketChannel.class);
            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);
            finished &= testHandler.latch.await(10, TimeUnit.SECONDS);

            logger.debug("Recorded exceptions: {}", testHandler.exceptions);

            assertProxyHandlers(false);

            assertEquals(1, testHandler.exceptions.size());
            Throwable e = testHandler.exceptions.poll();
            assertInstanceOf(ProxyConnectException.class, e);
            assertThat(String.valueOf(e)).contains(expectedMessage);
            assertTrue(finished);
        }
    }

Frequently Asked Questions

What is the FailureTestItem class?
FailureTestItem is a class in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java.
Where is FailureTestItem defined?
FailureTestItem is defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java at line 724.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free