Home / Function/ test() — netty Function Reference

test() — netty Function Reference

Architecture documentation for the test() function in ProxyHandlerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  52cef724_ddde_b832_a1de_156cd947f698["test()"]
  6b3e40b7_bbbe_9c71_290a_16df460e78f0["TimeoutTestItem"]
  52cef724_ddde_b832_a1de_156cd947f698 -->|defined in| 6b3e40b7_bbbe_9c71_290a_16df460e78f0
  60a5ed94_0116_766a_e8f8_176d65208647["assertProxyHandlers()"]
  52cef724_ddde_b832_a1de_156cd947f698 -->|calls| 60a5ed94_0116_766a_e8f8_176d65208647
  090e8ae4_53fb_bf5d_c36d_b71d6a972d9a["test()"]
  52cef724_ddde_b832_a1de_156cd947f698 -->|calls| 090e8ae4_53fb_bf5d_c36d_b71d6a972d9a
  style 52cef724_ddde_b832_a1de_156cd947f698 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java lines 772–809

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

Domain

Subdomains

Frequently Asked Questions

What does test() do?
test() is a function in the netty codebase, defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java.
Where is test() defined?
test() is defined in handler-proxy/src/test/java/io/netty/handler/proxy/ProxyHandlerTest.java at line 772.
What does test() call?
test() calls 2 function(s): assertProxyHandlers, test.

Analyze Your Own Codebase

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

Try Supermodel Free