From 2900cc22740d20a12699a93c207eb67a316bec2e Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Sun, 31 May 2020 21:00:42 +0200 Subject: [PATCH] [sinttest] Disconnect connection in LoginIntegrationTest So that it will cause an connectionClosedOnError() callback, caused by an connection-timeout stream error. --- .../org/jivesoftware/smack/LoginIntegrationTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java index 47c299671..7534c4449 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smack/LoginIntegrationTest.java @@ -58,11 +58,15 @@ public class LoginIntegrationTest extends AbstractSmackLowLevelIntegrationTest { AbstractXMPPConnection connection = getUnconnectedConnection(); connection.connect(); - SASLErrorException saslErrorException = assertThrows(SASLErrorException.class, - () -> connection.login(nonExistentUserString, invalidPassword)); + try { + SASLErrorException saslErrorException = assertThrows(SASLErrorException.class, + () -> connection.login(nonExistentUserString, invalidPassword)); - SaslNonza.SASLFailure saslFailure = saslErrorException.getSASLFailure(); - assertEquals(SASLError.not_authorized, saslFailure.getSASLError()); + SaslNonza.SASLFailure saslFailure = saslErrorException.getSASLFailure(); + assertEquals(SASLError.not_authorized, saslFailure.getSASLError()); + } finally { + connection.disconnect(); + } } }