Home / Class/ SocketStartTlsTest Class — netty Architecture

SocketStartTlsTest Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  f5337357_0024_1972_52c4_b6d1d4a7cb44["SocketStartTlsTest"]
  22dc6292_176b_7a59_4a97_0becd5db6cd4["SocketStartTlsTest.java"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|defined in| 22dc6292_176b_7a59_4a97_0becd5db6cd4
  85333874_bbf9_21e5_005d_921e38dec297["data()"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|method| 85333874_bbf9_21e5_005d_921e38dec297
  72927133_faa8_b42f_95a7_af6823b12ced["createExecutor()"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|method| 72927133_faa8_b42f_95a7_af6823b12ced
  fae38433_53e9_adee_3717_25926cf7d39a["shutdownExecutor()"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|method| fae38433_53e9_adee_3717_25926cf7d39a
  df82f643_c0be_bd9b_2d12_07146dcc426b["testStartTls()"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|method| df82f643_c0be_bd9b_2d12_07146dcc426b
  d83c679e_deb6_dae2_a1c2_3531af38b708["testStartTlsNotAutoRead()"]
  f5337357_0024_1972_52c4_b6d1d4a7cb44 -->|method| d83c679e_deb6_dae2_a1c2_3531af38b708

Relationship Graph

Source Code

testsuite/src/main/java/io/netty/testsuite/transport/socket/SocketStartTlsTest.java lines 65–347

public class SocketStartTlsTest extends AbstractSocketTest {
    private static final String PARAMETERIZED_NAME = "{index}: serverEngine = {0}, clientEngine = {1}";

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

    private static final LogLevel LOG_LEVEL = LogLevel.TRACE;
    private static final File CERT_FILE;
    private static final File KEY_FILE;
    private static EventExecutorGroup executor;

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

    public static Collection<Object[]> data() throws Exception {
        List<SslContext> serverContexts = new ArrayList<SslContext>();
        serverContexts.add(SslContextBuilder.forServer(CERT_FILE, KEY_FILE).sslProvider(SslProvider.JDK).build());

        List<SslContext> clientContexts = new ArrayList<SslContext>();
        clientContexts.add(SslContextBuilder.forClient()
                .sslProvider(SslProvider.JDK)
                .trustManager(CERT_FILE)
                .endpointIdentificationAlgorithm(null)
                .build());

        boolean hasOpenSsl = OpenSsl.isAvailable();
        if (hasOpenSsl) {
            serverContexts.add(SslContextBuilder.forServer(CERT_FILE, KEY_FILE)
                                                .sslProvider(SslProvider.OPENSSL).build());
            clientContexts.add(SslContextBuilder.forClient()
                    .sslProvider(SslProvider.OPENSSL)
                    .trustManager(CERT_FILE)
                    .endpointIdentificationAlgorithm(null)
                    .build());
        } else {
            logger.warn("OpenSSL is unavailable and thus will not be tested.", OpenSsl.unavailabilityCause());
        }

        List<Object[]> params = new ArrayList<Object[]>();
        for (SslContext sc: serverContexts) {
            for (SslContext cc: clientContexts) {
                params.add(new Object[] { sc, cc });
            }
        }
        return params;
    }

    @BeforeAll
    public static void createExecutor() {
        executor = new DefaultEventExecutorGroup(2);
    }

    @AfterAll
    public static void shutdownExecutor() throws Exception {
        executor.shutdownGracefully().sync();
    }

    @ParameterizedTest(name = PARAMETERIZED_NAME)
    @MethodSource("data")
    @Timeout(value = 30000, unit = TimeUnit.MILLISECONDS)
    public void testStartTls(final SslContext serverCtx, final SslContext clientCtx, TestInfo testInfo)
            throws Throwable {
        run(testInfo, new Runner<ServerBootstrap, Bootstrap>() {
            @Override
            public void run(ServerBootstrap serverBootstrap, Bootstrap bootstrap) throws Throwable {
                testStartTls(sb, cb, serverCtx, clientCtx);
            }
        });
    }

    public void testStartTls(ServerBootstrap sb, Bootstrap cb,
                             SslContext serverCtx, SslContext clientCtx) throws Throwable {

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free