public async Task Invoke(HttpContext context)
        {
            if (IsVip(context))
            {
                await _next(context);

                return;
            }

            var execData = new ExecutionData[_policies.Length];

            var enterResult = await EnterAsync(context, execData);

            if (enterResult.RejectedPolicy != null)
            {
                await ExitAsync(context, execData, enterResult.RejectedPolicyIndex, true);

                var rejectResponseContext = new QosRejectResponseContext()
                {
                    HttpContext = context,
                    Policy      = enterResult.RejectedPolicy
                };

                await enterResult.RejectedPolicy.RejectResponse.WriteAsync(rejectResponseContext);

                return;
            }

            try
            {
                await _next(context);
            }
            finally
            {
                await ExitAsync(context, execData, _policies.Length, false);
            }
        }
        public virtual Task WriteAsync(QosRejectResponseContext context)
        {
            context.HttpContext.Response.StatusCode = QosConstants.TooManyRequestHttpStatus;

            return(Task.CompletedTask);
        }