I\'m trying to connect to a remote server and send a login message in my Thread:
@Override public void run() { try { address = new InetSocketAddr
i've found an answer.. i should use:
socketChannel = SocketChannel.open(address); socketChannel.configureBlocking(false); while (!socketChannel.finishConnect()); //my code after connection
because the NIO is in not blocking mode we have to wait until it finish its connection