From d8fd208f35e92551dc96ce906d2f761a0e53af66 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 9 May 2016 22:56:48 +0300 Subject: try dialback to gtalk if host in unknown --- .../java/com/juick/xmpp/s2s/ConnectionOut.java | 23 +++++++++------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java index 5ef5fd3c..a80e88ff 100644 --- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java +++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java @@ -2,26 +2,17 @@ package com.juick.xmpp.s2s; import com.juick.xmpp.extensions.StreamFeatures; import com.juick.xmpp.utils.XmlUtils; +import org.xmlpull.v1.XmlPullParser; +import javax.net.ssl.SSLException; +import javax.net.ssl.SSLSocket; import java.io.EOFException; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.Socket; -import java.nio.channels.AsynchronousSocketChannel; -import java.nio.channels.Channels; -import java.nio.channels.CompletionHandler; -import java.util.concurrent.ExecutionException; +import java.net.UnknownHostException; import java.util.logging.Level; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import javax.net.ssl.SSLException; -import javax.net.ssl.SSLSocket; - /** * @author ugnich */ @@ -63,7 +54,11 @@ public class ConnectionOut extends Connection implements Runnable { LOGGER.info("STREAM TO " + to + " START"); try { HostnamePort addr = DNSQueries.getServerAddress(to); - socket = new Socket(InetAddress.getByName(addr.hostname), addr.port); + try { + socket = new Socket(InetAddress.getByName(addr.hostname), addr.port); + } catch (UnknownHostException e) { + socket = new Socket(InetAddress.getByName("talk.google.com"), 5269); + } restartParser(); sendOpenStream(); -- cgit v1.2.3