diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index 72f9cd4d0..f9e5054e9 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -545,11 +545,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { if (socketFactory == null) { socketFactory = SocketFactory.getDefault(); } + socket = socketFactory.createSocket(); for (HostAddress hostAddress : hostAddresses) { Iterator inetAddresses = null; String host = hostAddress.getFQDN(); int port = hostAddress.getPort(); - socket = socketFactory.createSocket(); try { inetAddresses = Arrays.asList(InetAddress.getAllByName(host)).iterator(); if (!inetAddresses.hasNext()) {