docs: public byte[] getPacketArray(boolean reUsable) throws IOException {
  
      //***************************************************
      //Read 4 byte header
      //***************************************************
      int remaining = 4;
      int off = 0;
      do {
        int count = inputStream.read(header, off, remaining);
        if (count < 0) {
          throw new EOFException("unexpected end of stream, read " + off
              + " bytes from 4 (socket was closed by server)");
        }
        remaining -= count;
        off += count;
      } while (remaining > 0);
  
      lastPacketLength = (header[0] & 0xff) + ((header[1] & 0xff) << 8) + ((header[2] & 0xff) << 16);
      packetSeq = header[3];
  
      //prepare array
      byte[] rawBytes;
      if (reUsable && lastPacketLength < REUSABLE_BUFFER_LENGTH) {
        rawBytes = reusableArray;
      } else {
        rawBytes = new byte[lastPacketLength];
      }
  
      //***************************************************
      //Read content
      //***************************************************
      remaining = lastPacketLength;
      off = 0;
      do {
        int count = inputStream.read(rawBytes, off, remaining);
        if (count < 0) {
          throw new EOFException(
              "unexpected end of stream, read " + (lastPacketLength - remaining) + " bytes from "
                  + lastPacketLength
                  + " (socket was closed by server)");
        }
        remaining -= count;
        off += count;
      } while (remaining > 0);
  
      if (traceCache != null) {
        traceCache.put(new TraceObject(false, NOT_COMPRESSED, Arrays.copyOfRange(header, 0, 4),
            Arrays.copyOfRange(rawBytes, 0, off > 1000 ? 1000 : off)));
      }
  
      if (logger.isTraceEnabled()) {
        logger.trace("read: {}{}",
            serverThreadLog,
            Utils.hexdump(maxQuerySizeToLog - 4, 0, lastPacketLength, header, rawBytes));
      }
  
      //***************************************************
      //In case content length is big, content will be separate in many 16Mb packets
      //***************************************************
      if (lastPacketLength == MAX_PACKET_SIZE) {
        int packetLength;
        do {
          remaining = 4;
          off = 0;
          do {
            int count = inputStream.read(header, off, remaining);
            if (count < 0) {
              throw new EOFException("unexpected end of stream, read " + off + " bytes from 4");
            }
            remaining -= count;
            off += count;
          } while (remaining > 0);
  
          packetLength = (header[0] & 0xff) + ((header[1] & 0xff) << 8) + ((header[2] & 0xff) << 16);
          packetSeq = header[3];
  
          int currentBufferLength = rawBytes.length;
          byte[] newRawBytes = new byte[currentBufferLength + packetLength];
          System.arraycopy(rawBytes, 0, newRawBytes, 0, currentBufferLength);
          rawBytes = newRawBytes;
  
          //***************************************************
          //Read content
          //***************************************************
          remaining = packetLength;
          off = currentBufferLength;
          do {
            int count = inputStream.read(rawBytes, off, remaining);
            if (count < 0) {
              throw new EOFException(
                  "unexpected end of stream, read " + (packetLength - remaining) + " bytes from "
                      + packetLength);
            }
            remaining -= count;
            off += count;
          } while (remaining > 0);
  
          if (traceCache != null) {
            traceCache.put(new TraceObject(false, NOT_COMPRESSED, Arrays.copyOfRange(header, 0, 4),
                Arrays.copyOfRange(rawBytes, 0, off > 1000 ? 1000 : off)));
          }
  
          if (logger.isTraceEnabled()) {
            logger.trace("read: {}{}",
                serverThreadLog,
                Utils.hexdump(maxQuerySizeToLog - 4, currentBufferLength, packetLength, header,
                    rawBytes));
          }
  
          lastPacketLength += packetLength;
        } while (packetLength == MAX_PACKET_SIZE);
      }
  
      return rawBytes;
    }