throw state changing exception on failed tls only if no more connection options left

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

Detailed changes

src/main/java/eu/siacs/conversations/xmpp/XmppConnection.java 🔗

@@ -395,7 +395,9 @@ public class XmppConnection implements Runnable {
 
 							if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomainpart(), ((SSLSocket) localSocket).getSession())) {
 								Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": TLS certificate verification failed");
-								throw new StateChangingException(Account.State.TLS_ERROR);
+								if (!iterator.hasNext()) {
+									throw new StateChangingException(Account.State.TLS_ERROR);
+								}
 							}
 						}
 						if (startXmpp(localSocket)) {