@BeforeEach
    public void setUp() throws Exception {
        File trustStoreFile = TestUtils.tempFile("truststore", ".jks");

        Map<String, Object> sslServerConfigs = TestSslUtils.createSslConfig(false, true, ConnectionMode.SERVER, trustStoreFile, "server");
        this.server = new EchoServer(SecurityProtocol.SSL, sslServerConfigs);
        this.server.start();
        this.time = new MockTime();
        sslClientConfigs = createSslClientConfigs(trustStoreFile);
        LogContext logContext = new LogContext();
        this.channelBuilder = new SslChannelBuilder(ConnectionMode.CLIENT, null, false, logContext);
        this.channelBuilder.configure(sslClientConfigs);
        this.metrics = new Metrics();
        this.selector = new Selector(5000, metrics, time, "MetricGroup", channelBuilder, logContext);
    }
A set of tests for the selector. These use a test harness that runs a simple socket server that echos back responses.
clients/src/test/java/org/apache/kafka/common/network/SslSelectorTest.java