code: static RpcVersionsCheckResult checkRpcProtocolVersions(
        RpcProtocolVersions localVersions, RpcProtocolVersions peerVersions) {
      Version maxCommonVersion;
      Version minCommonVersion;
      // maxCommonVersion is MIN(local.max, peer.max)
      if (isGreaterThanOrEqualTo(localVersions.getMaxRpcVersion(), peerVersions.getMaxRpcVersion())) {
        maxCommonVersion = peerVersions.getMaxRpcVersion();
      } else {
        maxCommonVersion = localVersions.getMaxRpcVersion();
      }
      // minCommonVersion is MAX(local.min, peer.min)
      if (isGreaterThanOrEqualTo(localVersions.getMinRpcVersion(), peerVersions.getMinRpcVersion())) {
        minCommonVersion = localVersions.getMinRpcVersion();
      } else {
        minCommonVersion = peerVersions.getMinRpcVersion();
      }
      if (isGreaterThanOrEqualTo(maxCommonVersion, minCommonVersion)) {
        return new RpcVersionsCheckResult.Builder()
            .setResult(true)
            .setHighestCommonVersion(maxCommonVersion)
            .build();
      }
      return new RpcVersionsCheckResult.Builder().setResult(false).build();
    }
docs: Performs check between local and peer Rpc Protocol Versions. This function returns true and the
  highest common version if there exists a common Rpc Protocol Version to use, and returns false
  and null otherwise.