code: private static long discard(ByteBuf buffer, long remainingToDiscard)
      {
          int availableToDiscard = (int) Math.min(remainingToDiscard, buffer.readableBytes());
          buffer.skipBytes(availableToDiscard);
          return remainingToDiscard - availableToDiscard;
      }
docs: How much remains to be discarded