@Test
public void testClientSendDuringSuspendMessages() throws Exception {
String newNodeHost = "newNode";
int numMessages = 4;
DummyClient client = createClientAndReassignIdentity(newNodeHost, true);
try {
client.waitForSuspendMessages();
for (int i = 0; i < numMessages; i++) {
MessageBuffer buf = new MessageBuffer(4);
buf.putInt(i);
client.sendMessage(buf.getBuffer(), false);
}
Thread.sleep(1000);
client.sendSuspendMessagesComplete();
SgsTestNode newNode = additionalNodes.get(newNodeHost);
client.waitForRelocationNotification(newNode.getAppPort());
client.validateMessageSequence(
client.sessionListenerReceivedMessages, numMessages, 0);
assertTrue(client.clientReceivedMessages.isEmpty());
client.relocate(newNode.getAppPort(), true, true);
client.waitForClientToReceiveExpectedMessages(numMessages);
client.validateMessageSequence(
client.clientReceivedMessages, numMessages, 0);
assertTrue(client.sessionListenerReceivedMessages.isEmpty());
} finally {
client.disconnect();
}
}