private void TickBodyWithMinimumDataRate(IKestrelTrace logger, int bytesPerSecond) { var gracePeriod = TimeSpan.FromSeconds(5); _httpConnectionContext.ServiceContext.ServerOptions.Limits.MinRequestBodyDataRate = new MinDataRate(bytesPerSecond: bytesPerSecond, gracePeriod: gracePeriod); _httpConnectionContext.ServiceContext.Log = logger; _httpConnection.Initialize(_httpConnectionContext.Transport); _httpConnection.Http1Connection.Reset(); // Initialize timestamp var now = DateTimeOffset.UtcNow; _httpConnection.Tick(now); _httpConnection.StartTimingReads(); // Tick after grace period w/ low data rate now += gracePeriod + TimeSpan.FromSeconds(1); _httpConnection.BytesRead(1); _httpConnection.Tick(now); }