docs: public boolean fetch() throws IOException {
          try {
              // Fetching packet header from input.
              if (!fetch0(0, NET_HEADER_SIZE)) {
                  logger.warn("Reached end of input stream while fetching header");
                  return false;
              }
  
              // Fetching the first packet(may a multi-packet).
              int netlen = getUint24(PACKET_LEN_OFFSET);
              int netnum = getUint8(PACKET_SEQ_OFFSET);
              if (!fetch0(NET_HEADER_SIZE, netlen)) {
                  logger.warn("Reached end of input stream: packet #" + netnum + ", len = " + netlen);
                  return false;
              }
  
              // Detecting error code.
              final int mark = getUint8(NET_HEADER_SIZE);
              if (mark != 0) {
                  if (mark == 255) // error from master
                  {
                      // Indicates an error, for example trying to fetch from
                      // wrong
                      // binlog position.
                      position = NET_HEADER_SIZE + 1;
                      final int errno = getInt16();
                      String sqlstate = forward(1).getFixString(SQLSTATE_LENGTH);
                      String errmsg = getFixString(limit - position);
                      throw new IOException("Received error packet:" + " errno = " + errno + ", sqlstate = " + sqlstate
                                            + " errmsg = " + errmsg);
                  } else if (mark == 254) {
                      // Indicates end of stream. It's not clear when this would
                      // be sent.
                      logger.warn("Received EOF packet from server, apparent" + " master disconnected.");
                      return false;
                  } else {
                      // Should not happen.
                      throw new IOException("Unexpected response " + mark + " while fetching binlog: packet #" + netnum
                                            + ", len = " + netlen);
                  }
              }
  
              // The first packet is a multi-packet, concatenate the packets.
              while (netlen == MAX_PACKET_LENGTH) {
                  if (!fetch0(0, NET_HEADER_SIZE)) {
                      logger.warn("Reached end of input stream while fetching header");
                      return false;
                  }
  
                  netlen = getUint24(PACKET_LEN_OFFSET);
                  netnum = getUint8(PACKET_SEQ_OFFSET);
                  if (!fetch0(limit, netlen)) {
                      logger.warn("Reached end of input stream: packet #" + netnum + ", len = " + netlen);
                      return false;
                  }
              }
  
              // Preparing buffer variables to decoding.
              origin = NET_HEADER_SIZE + 1;
              position = origin;
              limit -= origin;
              return true;
          } catch (SocketTimeoutException e) {
              close(); /* Do cleanup */
              logger.error("Socket timeout expired, closing connection", e);
              throw e;
          } catch (InterruptedIOException e) {
              close(); /* Do cleanup */
              logger.warn("I/O interrupted while reading from client socket", e);
              throw e;
          } catch (IOException e) {
              close(); /* Do cleanup */
              logger.error("I/O error while reading from client socket", e);
              throw e;
          }
      }