diff options
author | 2016-05-09 22:56:48 +0300 | |
---|---|---|
committer | 2016-05-09 22:56:48 +0300 | |
commit | d8fd208f35e92551dc96ce906d2f761a0e53af66 (patch) | |
tree | eda5e60c860c606c8bf94e1778e9285094a04444 /src/main/java/com/juick/xmpp/s2s/ConnectionOut.java | |
parent | 03730f1d23fe30d29bba57f0da13c9535d1a2024 (diff) |
try dialback to gtalk if host in unknown
Diffstat (limited to 'src/main/java/com/juick/xmpp/s2s/ConnectionOut.java')
-rw-r--r-- | src/main/java/com/juick/xmpp/s2s/ConnectionOut.java | 23 |
1 files 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(); |