1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-22 20:12:07 +01:00

[sinttest] Disconnect connection in LoginIntegrationTest

So that it will cause an connectionClosedOnError() callback, caused by
an connection-timeout stream error.
This commit is contained in:
Florian Schmaus 2020-05-31 21:00:42 +02:00
parent 7d129d6f6c
commit 2900cc2274

View file

@ -58,11 +58,15 @@ public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest {
AbstractXMPPConnection connection = getUnconnectedConnection(); AbstractXMPPConnection connection = getUnconnectedConnection();
connection.connect(); connection.connect();
SASLErrorException saslErrorException = assertThrows(SASLErrorException.class, try {
() -> connection.login(nonExistentUserString, invalidPassword)); SASLErrorException saslErrorException = assertThrows(SASLErrorException.class,
() -> connection.login(nonExistentUserString, invalidPassword));
SaslNonza.SASLFailure saslFailure = saslErrorException.getSASLFailure(); SaslNonza.SASLFailure saslFailure = saslErrorException.getSASLFailure();
assertEquals(SASLError.not_authorized, saslFailure.getSASLError()); assertEquals(SASLError.not_authorized, saslFailure.getSASLError());
} finally {
connection.disconnect();
}
} }
} }