private synchronized void sendStreamHeader(Element inbound) throws IOException
        {
            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"));

            if (!disableDialback) {
                root.add(new Namespace("db", "jabber:server:dialback"));
            }
            root.addAttribute("from", XMPP_DOMAIN);
            root.addAttribute("to", inbound.attributeValue("from", null));
            root.addAttribute("version", "1.0");
            root.addAttribute("id", StringUtils.randomString(5));

            send(root.asXML().substring(0, root.asXML().indexOf("</stream:stream>")));
        }
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