2015-05-27 17:36:04 +02:00
|
|
|
/**
|
|
|
|
*
|
2019-02-04 08:59:39 +01:00
|
|
|
* Copyright 2015-2019 Florian Schmaus
|
2015-05-27 17:36:04 +02:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
package org.jivesoftware.smack;
|
|
|
|
|
|
|
|
import static org.junit.Assert.assertTrue;
|
|
|
|
|
|
|
|
import java.lang.reflect.Field;
|
|
|
|
|
|
|
|
import org.igniterealtime.smack.inttest.AbstractSmackLowLevelIntegrationTest;
|
|
|
|
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
|
2016-12-19 18:10:04 +01:00
|
|
|
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
|
2015-05-27 17:36:04 +02:00
|
|
|
|
|
|
|
public class WaitForClosingStreamElementTest extends AbstractSmackLowLevelIntegrationTest {
|
|
|
|
|
2019-02-04 08:59:39 +01:00
|
|
|
public WaitForClosingStreamElementTest(SmackIntegrationTestEnvironment<?> environment) {
|
2016-12-19 18:10:04 +01:00
|
|
|
super(environment);
|
2015-05-27 17:36:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@SmackIntegrationTest
|
2019-02-04 08:59:39 +01:00
|
|
|
public void waitForClosingStreamElementTest(AbstractXMPPConnection connection)
|
2015-05-27 17:36:04 +02:00
|
|
|
throws NoSuchFieldException, SecurityException, IllegalArgumentException,
|
|
|
|
IllegalAccessException {
|
|
|
|
connection.disconnect();
|
|
|
|
|
2019-02-04 08:59:39 +01:00
|
|
|
Field closingStreamReceivedField = AbstractXMPPConnection.class.getDeclaredField("closingStreamReceived");
|
2015-05-27 17:36:04 +02:00
|
|
|
closingStreamReceivedField.setAccessible(true);
|
|
|
|
SynchronizationPoint<?> closingStreamReceived = (SynchronizationPoint<?>) closingStreamReceivedField.get(connection);
|
2017-03-12 14:55:38 +01:00
|
|
|
Exception failureException = closingStreamReceived.getFailureException();
|
|
|
|
if (failureException != null) {
|
|
|
|
throw new AssertionError("Sync poing yielded failure exception", failureException);
|
|
|
|
}
|
2015-05-27 17:36:04 +02:00
|
|
|
assertTrue(closingStreamReceived.wasSuccessful());
|
|
|
|
}
|
|
|
|
}
|