private void sendToRemoteEntity(String domain) {
        // Check if there is cached information about the requested domain
        String multicastService = cache.get(domain);
        if (multicastService != null) {
            sendToRemoteServer(domain, multicastService);
        }
        else {
            // No cached information was found so discover if remote server
            // supports JEP-33 (Extended Stanza Addressing). The reply to the disco
            // request is going to be process in #receivedAnswer(IQ packet)
            IQ iq = new IQ(IQ.Type.get);
            iq.setFrom(server.getServerInfo().getXMPPDomain());
            iq.setTo(domain);
            iq.setChildElement("query", "http://jabber.org/protocol/disco#info");
            // Indicate that we are searching for info of the specified domain
            nodes.put(domain, new CopyOnWriteArrayList<>());
            // Send the disco#info request to the remote server or component. The reply will be
            // processed by the IQResultListener (interface that this class implements)
            iqRouter.addIQResultListener(iq.getID(), this);
            iqRouter.route(iq);
        }
    }
Sends pending packets of the requested domain but first try to discover if remote server
supports multicast service. If we already have cached information about the requested
domain then just deliver the packet.

@param domain the domain that has pending packets to be sent.
xmppserver/src/main/java/org/jivesoftware/openfire/MulticastRouter.java