1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-12-06 05:01:12 +01:00

Added reconnection support. SMACK-172

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5367 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2006-09-14 19:16:40 +00:00 committed by gato
parent 96e4201f61
commit 3af86fd462
22 changed files with 501 additions and 194 deletions

View file

@ -20,11 +20,10 @@
package org.jivesoftware.smackx;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.SmackConfiguration;
import org.jivesoftware.smack.test.SmackTestCase;
/**
* Ensure that stream compression (JEP-138) is correctly supported by Smack.
@ -50,6 +49,7 @@ public class CompressionTest extends SmackTestCase {
config.setSASLAuthenticationEnabled(true);
XMPPConnection connection = new XMPPConnection(config);
connection.connect();
// Login with the test account
connection.login("user0", "user0");
@ -57,7 +57,7 @@ public class CompressionTest extends SmackTestCase {
assertTrue("Connection is not using stream compression", connection.isUsingCompression());
// Close connection
connection.close();
connection.disconnect();
}
protected int getMaxConnections() {
@ -70,6 +70,7 @@ public class CompressionTest extends SmackTestCase {
protected void setUp() throws Exception {
super.setUp();
XMPPConnection setupConnection = new XMPPConnection(getHost(), getPort());
setupConnection.connect();
if (!setupConnection.getAccountManager().supportsAccountCreation())
fail("Server does not support account creation");
@ -90,11 +91,12 @@ public class CompressionTest extends SmackTestCase {
protected void tearDown() throws Exception {
super.tearDown();
XMPPConnection setupConnection = new XMPPConnection(getHost(), getPort());
setupConnection.connect();
setupConnection.login("user0", "user0");
// Delete the created account for the test
setupConnection.getAccountManager().deleteAccount();
// Close the setupConnection
setupConnection.close();
setupConnection.disconnect();
}
}

View file

@ -250,6 +250,7 @@ public class MultiUserChatTest extends SmackTestCase {
try {
// Anonymous user joins the new room
XMPPConnection anonConnection = new XMPPConnection(getHost(), getPort());
anonConnection.connect();
anonConnection.loginAnonymously();
MultiUserChat muc2 = new MultiUserChat(anonConnection, room);
muc2.join("testbot2");
@ -265,7 +266,7 @@ public class MultiUserChatTest extends SmackTestCase {
// Anonymous user leaves the room
muc2.leave();
anonConnection.close();
anonConnection.disconnect();
Thread.sleep(250);
// User1 checks the presence of Anonymous user in the room
presence = muc.getOccupantPresence(room + "/testbot2");
@ -1766,6 +1767,7 @@ public class MultiUserChatTest extends SmackTestCase {
XMPPConnection[] conns = new XMPPConnection[20];
for (int i = 0; i < conns.length; i++) {
conns[i] = new XMPPConnection(getServiceName());
conns[i].connect();
conns[i].login(getUsername(1), getUsername(1), "resource-" + i);
}
@ -1788,7 +1790,7 @@ public class MultiUserChatTest extends SmackTestCase {
// Each connection leaves the room and closes the connection
for (int i = 0; i < mucs.length; i++) {
mucs[i].leave();
conns[i].close();
conns[i].disconnect();
}
} catch (Exception e) {