// let the first sequence expire
Thread.sleep(8000);
// expecting 3 outbounds and 2 inbounds
awaitMessages(3, 2, 5000);
MessageFlow mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(),
Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
// CS, GA, GA
mf.verifyMessages(3, true);
verifyCreateSequenceAction(0, "PT5S", mf, true);
String[] expectedActions = new String[] {RM10Constants.INSTANCE.getCreateSequenceAction(),
GREETMEONEWAY_ACTION,
GREETMEONEWAY_ACTION};
mf.verifyActions(expectedActions, true);
mf.verifyMessageNumbers(new String[] {null, "1", "2"}, true);
mf.verifyAcknowledgementRange(1, 2);
// phase two
outRecorder.getOutboundMessages().clear();
inRecorder.getInboundMessages().clear();
greeter.greetMeOneWay("three");
// expecting 2 outbounds and 2 inbounds
awaitMessages(2, 2, 5000);
mf = new MessageFlow(outRecorder.getOutboundMessages(), inRecorder.getInboundMessages(),
Names200408.WSA_NAMESPACE_NAME, RM10Constants.NAMESPACE_URI);
// CS, GA
mf.verifyMessages(2, true);
verifyCreateSequenceAction(0, "PT5S", mf, true);
expectedActions = new String[] {RM10Constants.INSTANCE.getCreateSequenceAction(),
GREETMEONEWAY_ACTION};
mf.verifyActions(expectedActions, true);
mf.verifyMessageNumbers(new String[] {null, "1"}, true);
// PR, CSR, PR, ACK
mf.verifyMessages(2, false);
expectedActions = new String[] {RM10Constants.INSTANCE.getCreateSequenceResponseAction(),
RM10Constants.INSTANCE.getSequenceAckAction()};
mf.verifyActions(expectedActions, false);
mf.purge();
assertEquals(0, outRecorder.getOutboundMessages().size());
assertEquals(0, inRecorder.getInboundMessages().size());
}