private void bounce(Message message) {
        // The bouncing behavior as implemented beyond this point was introduced as part
        // of OF-1852. This kill-switch allows it to be disabled again in case it
        // introduces unwanted side-effects.
        if ( !JiveGlobals.getBooleanProperty( "xmpp.message.bounce", true ) ) {
            log.trace( "Not bouncing a message stanza, as bouncing is disabled by configuration." );
            return;
        }

        // Do nothing if the packet included an error. This intends to prevent scenarios
        // where a stanza that is bounced itself gets bounced, causing a loop.
        if (message.getError() != null) {
            log.trace( "Not bouncing a stanza that included an error (to prevent never-ending loops of bounces-of-bounces)." );
            return;
        }

        // Do nothing if the sender was the server itself
        if (message.getFrom() == null || message.getFrom().toString().equals( serverName )) {
            log.trace( "Not bouncing a stanza that was sent by the server itself." );
            return;
        }
        try {
            log.trace( "Bouncing a message stanza: {}", message);

            // Generate a rejection response to the sender
            final Message errorResponse = message.createCopy();
            // return an error stanza to the sender, which SHOULD be <service-unavailable/>
            errorResponse.setError(PacketError.Condition.service_unavailable);
            errorResponse.setFrom(message.getTo());
            errorResponse.setTo(message.getFrom());
            // Send the response
            route(errorResponse);
        }
        catch (Exception e) {
            log.error("An exception occurred while trying to bounce a message.", e);
        }
    }
Notification message indicating that a packet has failed to be routed to the recipient.

@param recipient address of the entity that failed to receive the packet.
@param packet    Message packet that failed to be sent to the recipient.
xmppserver/src/main/java/org/jivesoftware/openfire/MessageRouter.java