for(int i=0; i < MESSAGE_COUNT/2; i++) {
Message m = receiveMessage(connection);
assertNotNull("Should have received message "+expected.get(0)+" by now!", m);
assertEquals(expected.remove(0), m.getMessageId().toString());
MessageAck ack = createAck(consumerInfo, m, 1, MessageAck.STANDARD_ACK_TYPE);
connection.send(ack);
}
connection.request(closeConnectionInfo(connectionInfo));
// restart the broker.
restartBroker();
// Setup the consumer and receive the message.
connection = createConnection();
connectionInfo = createConnectionInfo();
sessionInfo = createSessionInfo(connectionInfo);
connection.send(connectionInfo);
connection.send(sessionInfo);
consumerInfo = createConsumerInfo(sessionInfo, destination);
connection.send(consumerInfo);
for(int i=0; i < MESSAGE_COUNT/2; i++) {
Message m = receiveMessage(connection);
assertNotNull("Should have received message "+expected.get(i)+" by now!", m);
assertEquals(expected.get(i), m.getMessageId().toString());
MessageAck ack = createAck(consumerInfo, m, 1, MessageAck.STANDARD_ACK_TYPE);
connection.send(ack);
}