aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/test/java/com/juick/tests/JsonTests.java (renamed from src/test/java/com/juick/JsonTests.java)11
4 files changed, 10 insertions, 31 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;
- }
-}
diff --git a/src/test/java/com/juick/JsonTests.java b/src/test/java/com/juick/tests/JsonTests.java
index ba01e80c..babcc6c7 100644
--- a/src/test/java/com/juick/JsonTests.java
+++ b/src/test/java/com/juick/tests/JsonTests.java
@@ -1,18 +1,15 @@
-package com.juick;
-
-import static org.junit.Assert.assertEquals;
+package com.juick.tests;
+import com.juick.Message;
import com.juick.json.MessageSerializer;
-import org.junit.Assert;
import org.junit.Test;
-import com.juick.Message;
-
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.Calendar;
import java.util.TimeZone;
+import static org.junit.Assert.assertEquals;
+
public class JsonTests {
@Test
public void DateTest() {