Home / Class/ SocketTestPermutation Class — netty Architecture

SocketTestPermutation Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  d1a88829_0f4e_903e_71ca_619ab445cd85["SocketTestPermutation"]
  63b2faf8_cb0a_274f_4000_9639791356e2["SocketTestPermutation.java"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|defined in| 63b2faf8_cb0a_274f_4000_9639791356e2
  36e01be4_f343_d92c_9462_5b05616da59e["combo()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| 36e01be4_f343_d92c_9462_5b05616da59e
  50e0adfe_30dd_f27b_4d68_e61ba9cf2245["socket()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| 50e0adfe_30dd_f27b_4d68_e61ba9cf2245
  e375456a_bf0f_2c10_aae7_ea3b93f273e9["socketWithFastOpen()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| e375456a_bf0f_2c10_aae7_ea3b93f273e9
  24c44e9c_6631_5477_c4a4_f742a7b00e49["datagram()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| 24c44e9c_6631_5477_c4a4_f742a7b00e49
  5d76dd4b_2186_fbb9_d8f4_2e00853f4290["serverSocket()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| 5d76dd4b_2186_fbb9_d8f4_2e00853f4290
  ec452b79_ce61_9d68_8d89_e966050523c3["clientSocket()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| ec452b79_ce61_9d68_8d89_e966050523c3
  395a2524_301e_c941_89b8_34fe584ef056["clientSocketWithFastOpen()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| 395a2524_301e_c941_89b8_34fe584ef056
  c46d78b3_4721_7d6d_230c_52c2949a4efd["datagramSocket()"]
  d1a88829_0f4e_903e_71ca_619ab445cd85 -->|method| c46d78b3_4721_7d6d_230c_52c2949a4efd

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketTestPermutation.java lines 45–235

public class SocketTestPermutation {

    static final String BAD_HOST = SystemPropertyUtil.get("io.netty.testsuite.badHost", "198.51.100.254");
    static final int BAD_PORT = SystemPropertyUtil.getInt("io.netty.testsuite.badPort", 65535);
    static final boolean INCLUDE_OIO = SystemPropertyUtil.getBoolean("io.netty.testsuite.includeOio", false);

    // See /etc/services
    public static final int UNASSIGNED_PORT = 4;

    static {
        InternalLogger logger = InternalLoggerFactory.getInstance(SocketConnectionAttemptTest.class);
        logger.debug("-Dio.netty.testsuite.badHost: {}", BAD_HOST);
        logger.debug("-Dio.netty.testsuite.badPort: {}", BAD_PORT);
    }

    static final SocketTestPermutation INSTANCE = new SocketTestPermutation();

    protected static final int NUM_THREADS = 4;

    protected static final int OIO_SO_TIMEOUT = 10;  // Use short timeout for faster runs.

    protected final EventLoopGroup NIO_GROUP = new MultiThreadIoEventLoopGroup(
            NUM_THREADS, new DefaultThreadFactory("testsuite-nio", true), NioIoHandler.newFactory());
    protected final EventLoopGroup OIO_GROUP =
            new OioEventLoopGroup(Integer.MAX_VALUE, new DefaultThreadFactory("testsuite-oio", true));

    protected <A extends AbstractBootstrap<?, ?>, B extends AbstractBootstrap<?, ?>>

    List<BootstrapComboFactory<A, B>> combo(List<BootstrapFactory<A>> sbfs, List<BootstrapFactory<B>> cbfs) {

        List<BootstrapComboFactory<A, B>> list = new ArrayList<BootstrapComboFactory<A, B>>();

        // Populate the combinations
        for (BootstrapFactory<A> sbf: sbfs) {
            for (BootstrapFactory<B> cbf: cbfs) {
                final BootstrapFactory<A> sbf0 = sbf;
                final BootstrapFactory<B> cbf0 = cbf;
                list.add(new BootstrapComboFactory<A, B>() {
                    @Override
                    public A newServerInstance() {
                        return sbf0.newInstance();
                    }

                    @Override
                    public B newClientInstance() {
                        return cbf0.newInstance();
                    }
                });
            }
        }

        return list;
    }

    public List<BootstrapComboFactory<ServerBootstrap, Bootstrap>> socket() {
        // Make the list of ServerBootstrap factories.
        List<BootstrapFactory<ServerBootstrap>> sbfs = serverSocket();

        // Make the list of Bootstrap factories.
        List<BootstrapFactory<Bootstrap>> cbfs = clientSocket();

        // Populate the combinations
        List<BootstrapComboFactory<ServerBootstrap, Bootstrap>> list = combo(sbfs, cbfs);

        if (INCLUDE_OIO) {
            // Remove the OIO-OIO case which often leads to a dead lock by its nature.
            list.remove(list.size() - 1);
        }

        return list;
    }

    public List<BootstrapComboFactory<ServerBootstrap, Bootstrap>> socketWithFastOpen() {
        // Make the list of ServerBootstrap factories.
        List<BootstrapFactory<ServerBootstrap>> sbfs = serverSocket();

        // Make the list of Bootstrap factories.
        List<BootstrapFactory<Bootstrap>> cbfs = clientSocketWithFastOpen();

        // Populate the combinations
        List<BootstrapComboFactory<ServerBootstrap, Bootstrap>> list = combo(sbfs, cbfs);

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free