private synchronized void sendStartTlsProceed(Element inbound) throws Exception
        {
            if (encryptionPolicy == Connection.TLSPolicy.disabled) {
                final Document outbound = DocumentHelper.createDocument();
                final Namespace namespace = new Namespace("stream", "http://etherx.jabber.org/streams");
                final Element root = outbound.addElement(QName.get("stream", namespace));
                root.add(Namespace.get("jabber:server"));
                root.addElement(QName.get("failure", "urn:ietf:params:xml:ns:xmpp-tls"));

                send(root.asXML().substring(root.asXML().indexOf(">")+1));
                throw new InterruptedIOException("TLS Start received while feature is disabled. Kill the connection");
            }

            final Document outbound = DocumentHelper.createDocument();
            outbound.addElement(QName.get("proceed", "urn:ietf:params:xml:ns:xmpp-tls"));

            send(outbound.getRootElement().asXML());

            log("Replace the socket with one that will do TLS on the next inbound and outbound data");

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

            sc.init(createKeyManager(generatedPKIX == null ? null : generatedPKIX.getKeyPair(), generatedPKIX == null ? null : generatedPKIX.getCertificateChain()), createTrustManagerThatTrustsAll(), new java.security.SecureRandom());
            SSLContext.setDefault(sc);

            final SSLSocket sslSocket = (SSLSocket) ((SSLSocketFactory) SSLSocketFactory.getDefault()).createSocket(socket, null, true);
            sslSocket.setSoTimeout((int) SO_TIMEOUT.toMillis());

            // 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?

            processingService.submit(new SocketProcessor(sslSocket));
        }
To speed up the test execution, SO_TIMEOUT (the socket read timeout) has been set to a low value. When negotiating Server Dialback, a second
socket connection is used. XMPP session establishment on the first socket connection is paused while the Server Dialback negotiation takes
place. This can easily cause the SO_TIMEOUT to run out. To prevent issues, this implementation allows for reads of the first socket connection
to time out for a certain number of times, before treating this as a terminal exception.
xmppserver/src/test/java/org/jivesoftware/openfire/session/RemoteReceivingServerDummy.java