code: public static ResultPacket createResultPacket(final RawPacket rawPacket) throws IOException {
          byte b = rawPacket.getByteBuffer().get(0);
          switch (b) {
  
              case ERROR:
                  return new ErrorPacket(rawPacket);
              case OK:
                  return new OKPacket(rawPacket);
              case EOF:
                  return new EOFPacket(rawPacket);
              default:
                  return new ResultSetPacket(rawPacket);
          }
      }
docs: private static EOFPacket eof = new EOFPacket();