boolean readHandshakeForReceiver(final DataInput dis) {
    try {
      checkHandshakeInitialByte(dis);
      checkHandshakeVersion(dis);
      remoteMember = DSFIDFactory.readInternalDistributedMember(dis);
      sharedResource = dis.readBoolean();
      preserveOrder = dis.readBoolean();
      uniqueId = dis.readLong();
      // read the product version ordinal for on-the-fly serialization
      // transformations (for rolling upgrades)
      remoteVersion = Versioning.getKnownVersionOrDefault(
          Versioning.getVersion(VersioningIO.readOrdinal(dis)),
          null);
      final int dominoNumber = readDominoNumber(dis, sharedResource);
      dominoCount.set(dominoNumber);
      if (!sharedResource) {
        if (tipDomino()) {
          logger.info("thread owned receiver forcing itself to send on thread owned sockets");
          // if domino count is >= 2 use shared resources.
          // Also see DistributedCacheOperation#supportsDirectAck
        } else {
          ConnectionTable.threadWantsOwnResources();
          if (logger.isDebugEnabled()) {
            logger.debug(
                "thread-owned receiver with domino count of {} will prefer sending on thread-owned sockets",
                dominoNumber);
          }
        }
        conduit.getStats().incThreadOwnedReceivers(1L, dominoNumber);
        // Because this thread is not shared resource, it will be used for direct ack.
        // Direct ack messages can be large. This call will resize the send buffer.
        setSendBufferSize(socket);
      }
      setThreadName(dominoNumber);
    } catch (Exception e) {
      owner.getConduit().getCancelCriterion().checkCancelInProgress(e); // bug 37101
      logger.fatal("Error deserializing P2P handshake message", e);
      readerShuttingDown = true;
      requestClose("Error deserializing P2P handshake message");
      return true;
    }
    if (logger.isDebugEnabled()) {
      logger.debug("P2P handshake remoteAddr is {}{}", remoteMember,
          remoteVersion != null ? " (" + remoteVersion + ')' : "");
    }
    try {
      final String authInit = System.getProperty(SECURITY_SYSTEM_PREFIX + SECURITY_PEER_AUTH_INIT);
      final boolean isSecure = authInit != null && !authInit.isEmpty();

      if (isSecure) {
        if (!owner.getConduit().waitForMembershipCheck(remoteMember)) {
          notifyHandshakeWaiter(false);
          logger.warn("{} timed out during a membership check.", p2pReaderName());
          requestClose("timed out during a membership check");
          return true;
        }
      }
      sendOKHandshakeReply();
      notifyHandshakeWaiter(true);
      finishedConnecting = true;
    } catch (IOException ex) {
      final String err = "Failed sending handshake reply";
      if (logger.isDebugEnabled()) {
        logger.debug(err, ex);
      }
      readerShuttingDown = true;
      requestClose(err + ": " + ex);
      return true;
    }
    return false;
  }
Returns true if handshake was read successfully, false otherwise.
geode-core/src/main/java/org/apache/geode/internal/tcp/Connection.java