private void failDelivery(final List<Packet> packets) {
        if (packets == null) {
            // Do nothing if someone asked to deliver nothing :)
            return;
        }

        if (conn.getPacketDeliverer() == null) {
            Log.trace("Discarding packet that failed to be delivered to connection {}, for which no backup deliverer was configured.", this);
            return;
        }

        // use a separate thread to schedule backup delivery
        TaskEngine.getInstance().submit(() -> {
            for (final Packet packet : packets) {
                try {
                    conn.getPacketDeliverer().deliver(packet);
                }
                catch (UnauthorizedException e) {
                    Log.error("On session {} unable to deliver message to backup deliverer", getStreamID(), e);
                }
            }
        });
    }
Uses a connection to return data to the client.

@param connection The connection to use return data.
@param deliverables The data to be delivered.
@param async should the invocation block until the data has been delivered?
xmppserver/src/main/java/org/jivesoftware/openfire/http/HttpSession.java