diff --git a/src/main/java/org/spacehq/packetlib/tcp/TcpClientSession.java b/src/main/java/org/spacehq/packetlib/tcp/TcpClientSession.java index e11ddfc7..f1cac837 100644 --- a/src/main/java/org/spacehq/packetlib/tcp/TcpClientSession.java +++ b/src/main/java/org/spacehq/packetlib/tcp/TcpClientSession.java @@ -90,7 +90,7 @@ public class TcpClientSession extends TcpSession { ChannelFuture future = bootstrap.connect().sync(); if(future.isSuccess()) { - while(!isConnected()) { + while(!isConnected() && !disconnected) { try { Thread.sleep(5); } catch(InterruptedException e) {