/** * Binding completes the connection and makes it available to be used with the ConnectionManager. */ private boolean bind( TcpIpConnection connection, Address remoteEndPoint, Address localEndpoint, boolean reply) { if (logger.isFinestEnabled()) { logger.finest("Binding " + connection + " to " + remoteEndPoint + ", reply is " + reply); } final Address thisAddress = ioService.getThisAddress(); if (ioService.isSocketBindAny() && !connection.isClient() && !thisAddress.equals(localEndpoint)) { logger.warning( "Wrong bind request from " + remoteEndPoint + "! This node is not requested endpoint: " + localEndpoint); connection.close(); return false; } connection.setEndPoint(remoteEndPoint); ioService.onSuccessfulConnection(remoteEndPoint); if (reply) { sendBindRequest(connection, remoteEndPoint, false); } if (checkAlreadyConnected(connection, remoteEndPoint)) { return false; } return registerConnection(remoteEndPoint, connection); }