1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-29 23:42:06 +01:00

Added #testLoginWithNoResource for testing that a resource is always required by the server.

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2483 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-04-14 03:24:04 +00:00 committed by gaston
parent 85ecc4b776
commit d87a0fe615

View file

@ -76,6 +76,27 @@ public class LoginTest extends SmackTestCase {
}
}
/**
* Check that the server does not allow to log in without specifying a resource.
*/
public void testLoginWithNoResource() {
try {
XMPPConnection conn = new XMPPConnection(getHost(), getPort());
try {
conn.getAccountManager().createAccount("user_1", "user_1");
} catch (XMPPException e) {
// Do nothing if the accout already exists
if (e.getXMPPError().getCode() != 409) {
throw e;
}
}
conn.login("user_1", "user_1", null);
fail("User with no resource was able to log into the server");
} catch (XMPPException e) {
assertEquals("Wrong error code returned", 406, e.getXMPPError().getCode());
}
}
protected int getMaxConnections() {
return 0;