protected static void invokeInterceptors( Collection<PacketInterceptor> interceptors, Packet packet, Session session, boolean read, boolean processed ) throws PacketRejectedException
    {
        if ( interceptors == null || interceptors.isEmpty() )
        {
            return;
        }

        for ( final PacketInterceptor interceptor : interceptors )
        {
            try
            {
                interceptor.interceptPacket( packet, session, read, processed );
            }
            catch ( PacketRejectedException e )
            {
                if ( processed )
                {
                    Log.error( "Post interceptor cannot reject packet.", e );
                }
                else
                {
                    // Throw this exception since we don't really want to catch it
                    throw e;
                }
            }
            catch ( Throwable e )
            {
                Log.error( "Error in interceptor: " + interceptor + " while intercepting: " + packet, e );
            }
        }
    }
Invokes a collection of interceptors for the provided packet.

@param interceptors The interceptors to be triggered (can be null, can be empty).
@param packet       the packet that has been read or is about to be sent.
@param session      the session that received the packet or that the packet
                    will be sent to.
@param read         true indicates that the packet was read. When false, the packet
                    is being sent to a user.
@param processed    true if the packet has already processed (incoming or outgoing).
                    If the packet hasn't already been processed, this flag will be false.
@throws PacketRejectedException if the packet should be prevented from being processed.
xmppserver/src/main/java/org/jivesoftware/openfire/interceptor/InterceptorManager.java