public static void handleRejection(
            ChannelHandlerContext ctx,
            Object msg,
            RejectionType rejectionType,
            StatusCategory nfStatus,
            String reason,
            @Nullable Integer injectedLatencyMillis,
            HttpResponseStatus rejectedCode,
            String rejectedBody,
            Map<String, String> rejectionHeaders) {

        boolean shouldDropMessage = false;
        if (rejectionType == RejectionType.REJECT || rejectionType == RejectionType.CLOSE) {
            shouldDropMessage = true;
        }

        boolean shouldRejectNow = false;
        if (rejectionType == RejectionType.REJECT && msg instanceof LastHttpContent) {
            shouldRejectNow = true;
        } else if (rejectionType == RejectionType.CLOSE && msg instanceof HttpRequest) {
            shouldRejectNow = true;
        } else if (rejectionType == RejectionType.ALLOW_THEN_CLOSE && msg instanceof HttpRequest) {
            shouldRejectNow = true;
        }

        if (shouldRejectNow) {
            // Send a rejection response.
            HttpRequest request = msg instanceof HttpRequest ? (HttpRequest) msg : null;
            reject(
                    ctx,
                    rejectionType,
                    nfStatus,
                    reason,
                    request,
                    injectedLatencyMillis,
                    rejectedCode,
                    rejectedBody,
                    rejectionHeaders);
        }

        if (shouldDropMessage) {
            ReferenceCountUtil.safeRelease(msg);
        } else {
            ctx.fireChannelRead(msg);
        }
    }
Throttle either by sending rejection response message, or by closing the connection now, or just drop the
message. Only call this if ThrottleResult.shouldThrottle() returned {@code true}.

@param ctx                   the channel handler processing the request
@param msg                   the request that is being rejected.
@param rejectionType         the type of rejection
@param nfStatus              the status to use for metric reporting
@param reason                the reason for rejecting the request.  This is not sent back to the client.
@param injectedLatencyMillis optional parameter to delay sending a response. The reject notification is still
                             sent up the pipeline.
@param rejectedCode          the HTTP code to send back to the client.
@param rejectedBody          the HTTP body to be sent back.  It is assumed to be of type text/plain.
@param rejectionHeaders      additional HTTP headers to add to the rejection response
zuul-core/src/main/java/com/netflix/netty/common/throttle/RejectionUtils.java