Hi
This might be related to the discussion about the discussion at http://community.igniterealtime.org/message/219063#219063 about missing messages.
In this case the symptoms are similar, so I tried inserting a sleep, as shown below (**). This allowed the test to pass consistently.
Regards
Nathan
public void testMessageFlood() {
try {
Chat chat11 = getConnection(0).getChatManager().createChat(getBareJID(1), null);
PacketCollector chat12 = getConnection(1).createPacketCollector(
new ThreadFilter(chat11.getThreadID()));
Chat chat21 = getConnection(0).getChatManager().createChat(getBareJID(2), null);
PacketCollector chat22 = getConnection(2).createPacketCollector(
new ThreadFilter(chat21.getThreadID()));
Chat chat31 = getConnection(0).getChatManager().createChat(getBareJID(3), null);
PacketCollector chat32 = getConnection(3).createPacketCollector(
new ThreadFilter(chat31.getThreadID()));
for (int i=0; i<500; i++) {
chat11.sendMessage(“Hello_1” + i);
chat21.sendMessage(“Hello_2” + i);
chat31.sendMessage(“Hello_3” + i);
}
Thread.sleep(5000);//**
for (int i=0; i<500; i++) {
assertNotNull(“Some message was lost (” + i + “)”, chat12.nextResult(1000));
assertNotNull(“Some message was lost (” + i + “)”, chat22.nextResult(1000));
assertNotNull(“Some message was lost (” + i + “)”, chat32.nextResult(1000));
}
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}