Sync future instead of using listener.

This commit is contained in:
Steven Smith 2015-08-21 21:14:17 -07:00
parent 34c2a5c291
commit fa806e58fe

View file

@ -3,7 +3,6 @@ package org.spacehq.packetlib.tcp;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.ChannelPipeline;
@ -89,16 +88,7 @@ public class TcpClientSession extends TcpSession {
bootstrap.remoteAddress(host, port);
ChannelFuture future = bootstrap.connect();
future.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
if(!future.isSuccess()) {
exceptionCaught(null, future.cause());
}
}
}).await();
ChannelFuture future = bootstrap.connect().sync();
if(future.isSuccess()) {
while(!isConnected()) {
try {