Home / Class/ SocketSslEchoTest Class — netty Architecture

SocketSslEchoTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7["SocketSslEchoTest"]
  34cf25cc_6ea4_21b4_4971_fbf3fd40752e["SocketSslEchoTest.java"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|defined in| 34cf25cc_6ea4_21b4_4971_fbf3fd40752e
  acd87111_a6a0_a089_8f36_a51d821c7ed4["data()"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|method| acd87111_a6a0_a089_8f36_a51d821c7ed4
  ec0a494c_f5ab_8d75_d373_f1843e77b1bf["compressHeapDumps()"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|method| ec0a494c_f5ab_8d75_d373_f1843e77b1bf
  3c8d463e_2f57_7b8f_cb68_575450f0545e["testSslEcho()"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|method| 3c8d463e_2f57_7b8f_cb68_575450f0545e
  b7982577_45cd_0d7d_bdd1_225e3d9d5b6f["reset()"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|method| b7982577_45cd_0d7d_bdd1_225e3d9d5b6f
  4102d101_df19_f944_0dcd_20e90713eade["logStats()"]
  109bdf18_ef9b_f5ff_53b4_1150906b6ac7 -->|method| 4102d101_df19_f944_0dcd_20e90713eade

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketSslEchoTest.java lines 72–595

public class SocketSslEchoTest extends AbstractSocketTest {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(SocketSslEchoTest.class);

    private static final int FIRST_MESSAGE_SIZE = 16384;
    private static final Random random = new Random();
    private static final File CERT_FILE;
    private static final File KEY_FILE;
    static final byte[] data = new byte[1048576];

    static {
        random.nextBytes(data);

        try {
            X509Bundle cert = new CertificateBuilder()
                    .rsa2048()
                    .subject("cn=localhost")
                    .setIsCertificateAuthority(true)
                    .buildSelfSigned();
            CERT_FILE = cert.toTempCertChainPem();
            KEY_FILE = cert.toTempPrivateKeyPem();
        } catch (Exception e) {
            throw new ExceptionInInitializerError(e);
        }
    }

    protected enum RenegotiationType {
        NONE, // no renegotiation
        CLIENT_INITIATED, // renegotiation from client
        SERVER_INITIATED, // renegotiation from server
    }

    protected static class Renegotiation {
        static final Renegotiation NONE = new Renegotiation(RenegotiationType.NONE, null);

        final RenegotiationType type;
        final String cipherSuite;

        Renegotiation(RenegotiationType type, String cipherSuite) {
            this.type = type;
            this.cipherSuite = cipherSuite;
        }

        @Override
        public String toString() {
            if (type == RenegotiationType.NONE) {
                return "NONE";
            }

            return type + "(" + cipherSuite + ')';
        }
    }

    public static Collection<Object[]> data() throws Exception {
        List<SslContext> serverContexts = new ArrayList<SslContext>();
        serverContexts.add(SslContextBuilder.forServer(CERT_FILE, KEY_FILE)
                                            .sslProvider(SslProvider.JDK)
                                            // As we test renegotiation we should use a protocol that support it.
                                            .protocols("TLSv1.2")
                                            .build());

        List<SslContext> clientContexts = new ArrayList<SslContext>();
        clientContexts.add(SslContextBuilder.forClient()
                                            .sslProvider(SslProvider.JDK)
                                            .trustManager(CERT_FILE)
                                            // As we test renegotiation we should use a protocol that support it.
                                            .protocols("TLSv1.2")
                                            .endpointIdentificationAlgorithm(null)
                                            .build());

        boolean hasOpenSsl = OpenSsl.isAvailable();
        if (hasOpenSsl) {
            serverContexts.add(SslContextBuilder.forServer(CERT_FILE, KEY_FILE)
                                                .sslProvider(SslProvider.OPENSSL)
                                                // As we test renegotiation we should use a protocol that support it.
                                                .protocols("TLSv1.2")
                                                .build());
            clientContexts.add(SslContextBuilder.forClient()
                                                .sslProvider(SslProvider.OPENSSL)
                                                .trustManager(CERT_FILE)
                                                // As we test renegotiation we should use a protocol that support it.

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free