1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-12-13 06:21:08 +01:00

"not connected" is now a checked Exception thrown by sendPacket()

There is a unsolveable race condition between the connection state and
sendPacket(), i.e. the connection could go down, right after the
method calling sendPacket is called, but before sendPacket() is
invoked. Before this change, sendPacket() has thrown an unchecked
IllegalStateException, which could be ignored by the Smack user, who
would also not notice the race condition. We have decided to throw a
checked Exception in this case now, to make the Smack user aware of
this situation.

SMACK-426
This commit is contained in:
Florian Schmaus 2014-03-19 14:22:20 +01:00
parent d8c656270e
commit fcc8414a92
101 changed files with 845 additions and 382 deletions

View file

@ -19,6 +19,7 @@ package org.jivesoftware.smackx.bytestreams.ibb;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.XMPPError;
@ -66,9 +67,10 @@ public class InBandBytestreamRequestTest {
/**
* Test reject() method.
* @throws NotConnectedException
*/
@Test
public void shouldReplyWithErrorIfRequestIsRejected() {
public void shouldReplyWithErrorIfRequestIsRejected() throws NotConnectedException {
InBandBytestreamRequest ibbRequest = new InBandBytestreamRequest(
byteStreamManager, initBytestream);