private void bounce(Message message) {
        // Do nothing if the sender was the server itself
        if (message.getFrom() == null || message.getFrom().equals( serverAddress )) {
            return;
        }

        try {
            if (message.getType() == Message.Type.error){
                Log.debug("Avoid generating an error in response to a stanza that itself is an error (to avoid the chance of entering an endless back-and-forth of exchanging errors). Suppress sending an {} error in response to: {}", PacketError.Condition.service_unavailable, message);
            } else {
                // Generate a rejection response to the sender
                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
                router.route(errorResponse);
                // Inform listeners that an offline message was bounced
            }
            if (!listeners.isEmpty()) {
                for (OfflineMessageListener listener : listeners) {
                    try {
                        listener.messageBounced(message);
                    } catch (Exception e) {
                        Log.warn("An exception occurred while dispatching a 'messageBounced' event!", e);
                    }
                }
            }
        }
        catch (Exception e) {
            Log.error(e.getMessage(), e);
        }
    }
Unregisters a listener to receive events.

@param listener the listener.
xmppserver/src/main/java/org/jivesoftware/openfire/OfflineMessageStrategy.java