private void processStartTLSProceed(Element proceed) throws IOException, NoSuchAlgorithmException, KeyManagementException
        {
            log("Received StartTLS proceed.");
            log("Replace the socket with one that will do TLS on the next inbound and outbound data");

            final SSLContext sc = SSLContext.getInstance("TLSv1.3");

            TrustManager[] tm = createTrustManagerThatTrustsAll();
            SecureRandom random = new SecureRandom();


            KeyManager[] km = createKeyManager(new KeyPair(null, null), new X509Certificate[0]);
            if (generatedPKIX != null) {
                KeyPair keyPair = generatedPKIX.getKeyPair();
                X509Certificate[] certificateChain = generatedPKIX.getCertificateChain();
                km = createKeyManager(keyPair, certificateChain);
            }

            sc.init(km, tm , random);
            SSLContext.setDefault(sc);

            final SSLSocket sslSocket = (SSLSocket) ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket(socket, null, socket.getPort(), true);
            sslSocket.setSoTimeout((int) SO_TIMEOUT.multipliedBy(10).toMillis()); // TLS handshaking is resource intensive. Relax the SO_TIMEOUT value a bit, to prevent test failures in constraint environments.
            sslSocket.addHandshakeCompletedListener(event -> log("SSL handshake completed: " + event));
                sslSocket.startHandshake();

            // Just indicate that we would like to authenticate the client but if client
            // certificates are self-signed or have no certificate chain then we are still
            // good
            //sslSocket.setWantClientAuth(true); // DO WE NEED TO BRING THIS INTO OUR LocalOutgoingServerSessionTest MATRIX?
            phaser.register();

            final SocketProcessor sslSocketProcessor = new SocketProcessor(sslSocket);
            processingService.submit(sslSocketProcessor);
        }
Returns 'true' if negotiation was started, false if no negotiation was started.
xmppserver/src/test/java/org/jivesoftware/openfire/session/RemoteInitiatingServerDummy.java