mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-23 06:42:05 +01:00
Added new test case for IQ packets sent to full JIDs of offline users.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7411 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
5199427bbd
commit
44c5f274ea
1 changed files with 27 additions and 0 deletions
|
@ -26,6 +26,7 @@ import org.jivesoftware.smack.filter.PacketIDFilter;
|
||||||
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
import org.jivesoftware.smack.filter.PacketTypeFilter;
|
||||||
import org.jivesoftware.smack.packet.IQ;
|
import org.jivesoftware.smack.packet.IQ;
|
||||||
import org.jivesoftware.smack.test.SmackTestCase;
|
import org.jivesoftware.smack.test.SmackTestCase;
|
||||||
|
import org.jivesoftware.smackx.packet.Version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that the server is handling IQ packets correctly.
|
* Ensure that the server is handling IQ packets correctly.
|
||||||
|
@ -72,6 +73,32 @@ public class IQTest extends SmackTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check that sending an IQ to a full JID that is offline returns an IQ ERROR instead
|
||||||
|
* of being route to some other resource of the same user.
|
||||||
|
*/
|
||||||
|
public void testFullJIDToOfflineUser() {
|
||||||
|
// Request the version from the server.
|
||||||
|
Version versionRequest = new Version();
|
||||||
|
versionRequest.setType(IQ.Type.GET);
|
||||||
|
versionRequest.setFrom(getFullJID(0));
|
||||||
|
versionRequest.setTo(getBareJID(0) + "/Something");
|
||||||
|
|
||||||
|
// Create a packet collector to listen for a response.
|
||||||
|
PacketCollector collector = getConnection(0).createPacketCollector(
|
||||||
|
new PacketIDFilter(versionRequest.getPacketID()));
|
||||||
|
|
||||||
|
getConnection(0).sendPacket(versionRequest);
|
||||||
|
|
||||||
|
// Wait up to 5 seconds for a result.
|
||||||
|
IQ result = (IQ)collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
||||||
|
// Stop queuing results
|
||||||
|
collector.cancel();
|
||||||
|
assertNotNull("No response from server", result);
|
||||||
|
assertEquals("The server didn't reply with an error packet", IQ.Type.ERROR, result.getType());
|
||||||
|
assertEquals("Server answered an incorrect error code", 503, result.getError().getCode());
|
||||||
|
}
|
||||||
|
|
||||||
protected int getMaxConnections() {
|
protected int getMaxConnections() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue