try {
if (channel.socket.connect(remoteAddress)) {
future.setSuccess();
nextWorker().register(channel);
} else {
future.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
if (future.isCancelled()) {
channel.close();
}
}