mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-27 13:07:58 +01:00
Added new test case for offline messages with invalid XML characters.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@5069 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
727304b25e
commit
8576a13de7
1 changed files with 36 additions and 0 deletions
|
@ -72,6 +72,42 @@ public class MessageTest extends SmackTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send messages with invalid XML characters to offline users. Check that offline users
|
||||
* are receiving them from the server.
|
||||
*/
|
||||
public void testOfflineMessageInvalidXML() {
|
||||
// Make user2 unavailable
|
||||
getConnection(1).sendPacket(new Presence(Presence.Type.unavailable));
|
||||
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
|
||||
// User1 sends some messages to User2 which is not available at the moment
|
||||
Chat chat = getConnection(0).createChat(getBareJID(1));
|
||||
chat.sendMessage("Test \f 1");
|
||||
chat.sendMessage("Test \r 1");
|
||||
|
||||
Thread.sleep(500);
|
||||
|
||||
// User2 becomes available again
|
||||
PacketCollector collector = getConnection(1).createPacketCollector(new MessageTypeFilter(Message.Type.CHAT));
|
||||
getConnection(1).sendPacket(new Presence(Presence.Type.available));
|
||||
|
||||
// Check that offline messages are retrieved by user2 which is now available
|
||||
Message message = (Message) collector.nextResult(2500);
|
||||
assertNotNull(message);
|
||||
message = (Message) collector.nextResult(2000);
|
||||
assertNotNull(message);
|
||||
message = (Message) collector.nextResult(1000);
|
||||
assertNull(message);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that two clients are able to send messages with a body of 4K characters and their
|
||||
* connections are not being closed.
|
||||
|
|
Loading…
Reference in a new issue