private void keepTrying(final Bootstrap b) {
b.connect().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture cf) throws Exception {
if(cf.isSuccess()) {
System.out.println("Connected successfully");
} else {
Thread.sleep(10*1000);
System.out.println("connection attempt failed, econnecting");
b.connect().addListener(this);
}
}
});
}