Home / Class/ SocketMultipleConnectTest Class — netty Architecture

SocketMultipleConnectTest Class — netty Architecture

Architecture documentation for the SocketMultipleConnectTest class in SocketMultipleConnectTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  d8bf61f8_e741_679a_49cc_e3114c0c0307["SocketMultipleConnectTest"]
  286ee39f_1c4b_fa04_8b75_f56cded28358["SocketMultipleConnectTest.java"]
  d8bf61f8_e741_679a_49cc_e3114c0c0307 -->|defined in| 286ee39f_1c4b_fa04_8b75_f56cded28358
  25b08b2b_16bc_7b9f_8369_542ecc080a90["testMultipleConnect()"]
  d8bf61f8_e741_679a_49cc_e3114c0c0307 -->|method| 25b08b2b_16bc_7b9f_8369_542ecc080a90
  f3314095_c1b7_b3d1_f21c_b5cc1e8db6ec["newFactories()"]
  d8bf61f8_e741_679a_49cc_e3114c0c0307 -->|method| f3314095_c1b7_b3d1_f21c_b5cc1e8db6ec

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java lines 39–87

public class SocketMultipleConnectTest extends AbstractSocketTest {

    @Test
    @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
    public void testMultipleConnect(TestInfo testInfo) throws Throwable {
        run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
                testMultipleConnect(serverBootstrap, bootstrap);
            }
        });
    }

    public void testMultipleConnect(ServerBootstrap sb, Bootstrap cb) throws Exception {
        Channel sc = null;
        Channel cc = null;
        try {
            sb.childHandler(new ChannelInboundHandlerAdapter());
            sc = sb.bind(NetUtil.LOCALHOST, 0).syncUninterruptibly().channel();

            cb.handler(new ChannelInboundHandlerAdapter());
            cc = cb.register().syncUninterruptibly().channel();
            cc.connect(sc.localAddress()).syncUninterruptibly();
            ChannelFuture connectFuture2 = cc.connect(sc.localAddress()).await();
            assertTrue(connectFuture2.cause() instanceof AlreadyConnectedException);
        } finally {
            if (cc != null) {
                cc.close();
            }
            if (sc != null) {
                sc.close();
            }
        }
    }

    @Override
    protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
        List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> factories
                = new ArrayList<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>>();
        for (TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap> comboFactory
                : SocketTestPermutation.INSTANCE.socketWithFastOpen()) {
            EventLoopGroup group = comboFactory.newClientInstance().config().group();
            if (group instanceof IoEventLoopGroup && ((IoEventLoopGroup) group).isIoType(NioIoHandler.class)) {
                factories.add(comboFactory);
            }
        }
        return factories;
    }
}

Frequently Asked Questions

What is the SocketMultipleConnectTest class?
SocketMultipleConnectTest is a class in the netty codebase, defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java.
Where is SocketMultipleConnectTest defined?
SocketMultipleConnectTest is defined in testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketMultipleConnectTest.java at line 39.

Analyze Your Own Codebase

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

Try Supermodel Free