Home / Class/ TimeoutTestItem Class — netty Architecture

TimeoutTestItem Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  6b3e40b7_bbbe_9c71_290a_16df460e78f0["TimeoutTestItem"]
  8ee69b4d_9955_829a_96d0_8c943277a68d["ProxyHandlerTest.java"]
  6b3e40b7_bbbe_9c71_290a_16df460e78f0 -->|defined in| 8ee69b4d_9955_829a_96d0_8c943277a68d
  ad858555_543c_8dff_96cb_8f50e45eac73["TimeoutTestItem()"]
  6b3e40b7_bbbe_9c71_290a_16df460e78f0 -->|method| ad858555_543c_8dff_96cb_8f50e45eac73
  52cef724_ddde_b832_a1de_156cd947f698["test()"]
  6b3e40b7_bbbe_9c71_290a_16df460e78f0 -->|method| 52cef724_ddde_b832_a1de_156cd947f698

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java lines 766–810

    private static final class TimeoutTestItem extends TestItem {

        TimeoutTestItem(String name, ChannelHandler... clientHandlers) {
            super(name, null, clientHandlers);
        }

        @Override
        protected void test() throws Exception {
            final long TIMEOUT = 2000;
            for (ChannelHandler h: clientHandlers) {
                if (h instanceof ProxyHandler) {
                    ((ProxyHandler) h).setConnectTimeoutMillis(TIMEOUT);
                }
            }

            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);
                }
            });

            ChannelFuture cf = b.connect(DESTINATION).channel().closeFuture();
            boolean finished = cf.await(TIMEOUT * 2, TimeUnit.MILLISECONDS);
            finished &= testHandler.latch.await(TIMEOUT * 2, TimeUnit.MILLISECONDS);

            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("timeout");
            assertTrue(finished);
        }
    }

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free