Source:
private void handshakeRes(ProtocolVersion proposedVer, String user, String pwd, Map<String, String> userAttrs) throws ClientConnectionException, ClientAuthenticationException { int resSize = dataInput.readInt(); if (resSize <= 0) throw new ClientProtocolError(String.format("Invalid handshake response size: %s", resSize)); BinaryInputStream res = new BinaryHeapInputStream(dataInput.read(resSize)); try (BinaryReaderExImpl reader = new BinaryReaderExImpl(null, res, null, true)) { boolean success = res.readBoolean(); if (success) { byte[] features = new byte[0]; if (ProtocolContext.isFeaturesSupported(proposedVer)) { features = reader.readByteArray(); } protocolContext = new ProtocolContext(proposedVer, ProtocolFeature.enumSet(features)); if (protocolContext.isPartitionAwarenessSupported()) { srvNodeId = reader.readUuid(); } } else { ProtocolVersion srvVer = new ProtocolVersion(res.readShort(), res.readShort(), res.readShort()); String err = reader.readString(); int errCode = ClientStatus.FAILED; if (res.remaining() > 0) errCode = reader.readInt(); if (errCode == ClientStatus.AUTH_FAILED) throw new ClientAuthenticationException(err); else if (proposedVer.equals(srvVer)) throw new ClientProtocolError(err); else if (!supportedVers.contains(srvVer) || (srvVer.compareTo(V1_1_0) < 0 && !F.isEmpty(user))) throw new ClientProtocolError(String.format( "Protocol version mismatch: client %s / server %s. Server details: %s", proposedVer, srvVer, err )); else { handshake(srvVer, user, pwd, userAttrs); } } } catch (IOException e) { throw handleIOError(e); } }

Target:
private void handshakeRes(ProtocolVersion proposedVer, String user, String pwd, Map<String, String> userAttrs) throws ClientConnectionException, ClientAuthenticationException { int resSize = dataInput.readInt(); if (resSize <= 0) throw new ClientProtocolError(String.format("Invalid handshake response size: %s", resSize)); BinaryInputStream res = new BinaryHeapInputStream(dataInput.read(resSize)); try (BinaryReaderExImpl reader = new BinaryReaderExImpl(null, res, null, true)) { boolean success = res.readBoolean(); if (success) { byte[] features = new byte[0]; if (ProtocolContext.isFeatureSupported(proposedVer, BITMAP_FEATURES)) features = reader.readByteArray(); protocolCtx = new ProtocolContext(proposedVer, ProtocolBitmaskFeature.enumSet(features)); if (protocolCtx.isFeatureSupported(PARTITION_AWARENESS)) { srvNodeId = reader.readUuid(); } } else { ProtocolVersion srvVer = new ProtocolVersion(res.readShort(), res.readShort(), res.readShort()); String err = reader.readString(); int errCode = ClientStatus.FAILED; if (res.remaining() > 0) errCode = reader.readInt(); if (errCode == ClientStatus.AUTH_FAILED) throw new ClientAuthenticationException(err); else if (proposedVer.equals(srvVer)) throw new ClientProtocolError(err); else if (!supportedVers.contains(srvVer) || (!ProtocolContext.isFeatureSupported(srvVer, AUTHORIZATION) && !F.isEmpty(user))) throw new ClientProtocolError(String.format( "Protocol version mismatch: client %s / server %s. Server details: %s", proposedVer, srvVer, err )); else { handshake(srvVer, user, pwd, userAttrs); } } } catch (IOException e) { throw handleIOError(e); } }