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/ConnectionRouter.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
index e68e030f..95878edd 100644
--- a/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
+++ b/src/main/java/com/juick/xmpp/s2s/ConnectionRouter.java
@@ -12,7 +12,6 @@ import com.juick.xmpp.extensions.XOOB;
import java.io.IOException;
import java.net.Socket;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -25,12 +24,16 @@ public class ConnectionRouter implements Stream.StreamListener,
private static final Logger logger = Logger.getLogger(ConnectionRouter.class.getName());
private String componentName;
+ private String password;
Stream router;
Socket socket;
ConnectionRouter(String componentName, String password) {
this.componentName = componentName;
- logger.info("STREAM ROUTER START");
+ this.password = password;
+ reconnect();
+ }
+ public void reconnect() {
try {
socket = new Socket("localhost", 5347);
router = new StreamComponent(new JID("s2s"), socket.getInputStream(), socket.getOutputStream(), password);
@@ -39,6 +42,7 @@ public class ConnectionRouter implements Stream.StreamListener,
router.addListener((Message.MessageListener) this);
router.addListener((Iq.IqListener) this);
router.startParsing();
+ logger.info("STREAM ROUTER START");
} catch (IOException e) {
logger.log(Level.SEVERE, "router failed", e);
}
@@ -240,5 +244,6 @@ public class ConnectionRouter implements Stream.StreamListener,
@Override
public void onStreamFail(Exception ex) {
logger.log(Level.SEVERE, "STREAM ROUTER (FAIL)", ex);
+ reconnect();
}
}