1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 22:32:06 +01:00

Improved setup to recover if the account already exists.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2481 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-04-14 02:08:56 +00:00 committed by gaston
parent 7668ad5ce5
commit 9774b8e029

View file

@ -58,6 +58,7 @@ import java.util.Enumeration;
import javax.net.SocketFactory;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
import org.xmlpull.v1.*;
import org.xmlpull.mxp1.MXParser;
@ -227,7 +228,14 @@ public abstract class SmackTestCase extends TestCase {
for (int i = 0; i < getMaxConnections(); i++) {
// Create the test account
getConnection(i).getAccountManager().createAccount("user" + i, "user" + i);
try {
getConnection(i).getAccountManager().createAccount("user" + i, "user" + i);
} catch (XMPPException e) {
// Do nothing if the accout already exists
if (e.getXMPPError().getCode() != 409) {
throw e;
}
}
// Login with the new test account
getConnection(i).login("user" + i, "user" + i);
}