code: private ByteBuf decodeLine(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
          final int eol = findEndOfLine(buffer);
          if (!discarding) {
              if (eol >= 0) {
                  final int length = eol - buffer.readerIndex();
                  if (length > V1_MAX_LENGTH) {
                      buffer.readerIndex(eol + DELIMITER_LENGTH);
                      failOverLimit(ctx, length);
                      return null;
                  }
                  ByteBuf frame = buffer.readSlice(length);
                  buffer.skipBytes(DELIMITER_LENGTH);
                  return frame;
              } else {
                  final int length = buffer.readableBytes();
                  if (length > V1_MAX_LENGTH) {
                      discardedBytes = length;
                      buffer.skipBytes(length);
                      discarding = true;
                      failOverLimit(ctx, "over " + discardedBytes);
                  }
                  return null;
              }
          } else {
              if (eol >= 0) {
                  final int delimLength = buffer.getByte(eol) == '\r' ? 2 : 1;
                  buffer.readerIndex(eol + delimLength);
                  discardedBytes = 0;
                  discarding = false;
              } else {
                  discardedBytes = buffer.readableBytes();
                  buffer.skipBytes(discardedBytes);
              }
              return null;
          }
      }
docs: Create a frame out of the {@link ByteBuf} and return it.
  Based on code from {@link LineBasedFrameDecoder#decode(ChannelHandlerContext, ByteBuf)}.
  
  @param ctx     the {@link ChannelHandlerContext} which this {@link HAProxyMessageDecoder} belongs to
  @param buffer  the {@link ByteBuf} from which to read data
  @return frame  the {@link ByteBuf} which represent the frame or {@code null} if no frame could
  be created