private void init() throws Exception {
            // Create certificates for use by client and server. Add server cert to client truststore and vice versa.
            serverCertStores = certBuilder(true, "server", useInlinePem).addHostName("localhost").build();
            clientCertStores = certBuilder(false, "client", useInlinePem).addHostName("localhost").build();
            sslServerConfigs = getTrustingConfig(serverCertStores, clientCertStores);
            sslClientConfigs = getTrustingConfig(clientCertStores, serverCertStores);
            sslServerConfigs.put(SslConfigs.SSL_ENGINE_FACTORY_CLASS_CONFIG, DefaultSslEngineFactory.class);
            sslClientConfigs.put(SslConfigs.SSL_ENGINE_FACTORY_CLASS_CONFIG, DefaultSslEngineFactory.class);
        }
Tests for the SSL transport layer. These use a test harness that runs a simple socket server that echos back responses.
clients/src/test/java/org/apache/kafka/common/network/SslTransportLayerTest.java