private void completeRequest(boolean closeNetworkChannel, boolean shouldDelay, boolean shouldCloseRequest) {
    if ((closeNetworkChannel || forceClose) && ctx.channel().isOpen()) {
      if (shouldDelay && (request != null && request.getRestMethod().equals(RestMethod.POST))
          && this.nettyConfig.nettyServerCloseDelayTimeoutMs > 0) {
        nettyMetrics.delayedCloseScheduledCount.inc();
        writeFuture.addListener(DELAYED_CLOSE);
      } else {
        writeFuture.addListener(ChannelFutureListener.CLOSE);
      }
      logger.trace("Requested closing of channel {}", ctx.channel());
    }
    closeRequest(shouldCloseRequest);
  }
Completes the request by closing the request and network channel (if {@code closeNetworkChannel} is {@code true}).
</p>
May also close the channel if the class internally is forcing a close (i.e. if {@link #close()} is called.

@param closeNetworkChannel network channel is closed if {@code true}.
@param shouldDelay         network channel may be closed after certain delay if {@code true}.
@param shouldCloseRequest used to determine if we want to close the request or not.
ambry-rest/src/main/java/com/github/ambry/rest/NettyResponseChannel.java