aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/xmpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/xmpp')
-rw-r--r--src/main/java/com/juick/xmpp/s2s/ConnectionOut.java9
-rw-r--r--src/main/java/com/juick/xmpp/s2s/DNSQueries.java5
-rw-r--r--src/main/java/com/juick/xmpp/s2s/HostnamePort.java16
3 files changed, 6 insertions, 24 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
index fede701e..cf54997f 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java
@@ -10,6 +10,7 @@ import javax.net.ssl.SSLSocket;
import java.io.EOFException;
import java.io.IOException;
import java.net.InetAddress;
+import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
@@ -61,12 +62,8 @@ public class ConnectionOut extends Connection implements Runnable {
public void run() {
LOGGER.info("STREAM TO " + to + " START");
try {
- HostnamePort addr = DNSQueries.getServerAddress(to);
- try {
- socket = new Socket(InetAddress.getByName(addr.hostname), addr.port);
- } catch (UnknownHostException e) {
- socket = new Socket(InetAddress.getByName("talk.google.com"), 5269);
- }
+ socket = new Socket();
+ socket.connect(DNSQueries.getServerAddress(to));
restartParser();
sendOpenStream();
diff --git a/src/main/java/com/juick/xmpp/s2s/DNSQueries.java b/src/main/java/com/juick/xmpp/s2s/DNSQueries.java
index 2b2d60e0..e4c5f085 100644
--- a/src/main/java/com/juick/xmpp/s2s/DNSQueries.java
+++ b/src/main/java/com/juick/xmpp/s2s/DNSQueries.java
@@ -1,5 +1,6 @@
package com.juick.xmpp.s2s;
+import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.Hashtable;
import java.util.Random;
@@ -16,7 +17,7 @@ public class DNSQueries {
private static Random rand = new Random();
- public static HostnamePort getServerAddress(String hostname) throws UnknownHostException {
+ public static InetSocketAddress getServerAddress(String hostname) throws UnknownHostException {
String host = hostname;
int port = 5269;
@@ -41,6 +42,6 @@ public class DNSQueries {
} catch (NamingException e) {
}
- return new HostnamePort(host, port);
+ return new InetSocketAddress(host, port);
}
}
diff --git a/src/main/java/com/juick/xmpp/s2s/HostnamePort.java b/src/main/java/com/juick/xmpp/s2s/HostnamePort.java
deleted file mode 100644
index ce020f8d..00000000
--- a/src/main/java/com/juick/xmpp/s2s/HostnamePort.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.juick.xmpp.s2s;
-
-/**
- *
- * @author ugnich
- */
-public class HostnamePort {
-
- public String hostname;
- public int port;
-
- public HostnamePort(String hostname, int port) {
- this.hostname = hostname;
- this.port = port;
- }
-}