public void readHeader() throws IOException {
    if (socket != null) {
      final ByteBuffer cb = getCommBuffer();
      synchronized (cb) {
        fetchHeader();
        final int type = cb.getInt();
        final int numParts = cb.getInt();
        final int txid = cb.getInt();
        cb.clear();
        if (!MessageType.validate(type)) {
          throw new IOException(
              String.format("Invalid message type %s while reading header", type));
        }

        // Set the header and payload fields only after receiving all the
        // socket data, providing better message consistency in the face
        // of exceptional conditions (e.g. IO problems, timeouts etc.)
        messageType = MessageType.valueOf(type);
        numberOfParts = numParts; // Already set in setPayloadFields via setNumberOfParts
        transactionId = txid;
      }
    } else {
      throw new IOException("Dead Connection");
    }
  }
Populates the header with information received via socket
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ChunkedMessage.java