return new ServerHandshakeHandler<BitHandshake>(RpcType.HANDSHAKE, BitHandshake.PARSER){
@Override
public MessageLite getHandshakeResponse(BitHandshake inbound) throws Exception {
// logger.debug("Handling handshake from other bit. {}", inbound);
if(inbound.getRpcVersion() != BitRpcConfig.RPC_VERSION) throw new RpcException(String.format("Invalid rpc version. Expected %d, actual %d.", inbound.getRpcVersion(), BitRpcConfig.RPC_VERSION));
if(!inbound.hasEndpoint() || inbound.getEndpoint().getAddress().isEmpty() || inbound.getEndpoint().getBitPort() < 1) throw new RpcException(String.format("RPC didn't provide valid counter endpoint information. Received %s.", inbound.getEndpoint()));
connection.setEndpoint(inbound.getEndpoint());
// add the
BitConnectionManager manager = connectionRegistry.getConnectionManager(inbound.getEndpoint());