public void queue(@Nonnull final DomainPair domainPair, @Nonnull final Packet packet)
    {
        if (!packet.getFrom().getDomain().equals(domainPair.getLocal())) {
            throw new IllegalArgumentException("Packet's 'from' domain ("+packet.getFrom().getDomain()+") does not match domainPair's local ("+domainPair.getLocal()+")");
        }
        if (!packet.getTo().getDomain().equals(domainPair.getRemote())) {
            throw new IllegalArgumentException("Packet's 'to' domain ("+packet.getTo().getDomain()+") does not match domainPair's remote ("+domainPair.getRemote()+")");
        }
        final PacketsProcessor processor = packetsProcessors.get(domainPair);
        if (processor == null) {
            throw new IllegalStateException("Attempt to queue stanza for " + domainPair + " while no processor exists for that domain pair.");
        }
        Log.trace("Queuing stanza for {}", domainPair);
        processor.addPacket(packet);
    }
Queues a stanza for delivery to a remote domain after an ongoing process to establish that connection has finished.

A process for the target DomainPair must exist. This method will throw an exception when it does not.

The returned value of {@link #hasProcess(DomainPair)} can be used to determine if a process exists. The
invocations of that method and this method should be guarded by the mutex returned by {@link #getMutex(DomainPair)}
to ensure thread safety, as holding that mutex will prevent other threads to finish the running process.

@param domainPair The domainPair that describes the local and remote domain between which the stanza is to be sent
@param packet the stanza to send to the remote domain (addressing must correspond with the domainPair argument)
@throws IllegalStateException when a process does not exist for the domainPair
xmppserver/src/main/java/org/jivesoftware/openfire/server/OutgoingSessionPromise.java