From 7845f21465fd95efba2959e71b26cc6ab28ea690 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 10 Jan 2016 18:24:01 +0100 Subject: [PATCH] Only create the socket once in XMPPTCPConnection.connectUsingConfiguration(). --- .../main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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()) {