msgIn[i] = publisherSession.createTextMessage();
msgIn[i].setText("msg " + i);
publisher.send(this.topic, msgIn[i]);
}
for (int i=0; i < nmax; i++) {
msg2 = consumer.receiveNoWait();
if (!(msg2 instanceof TextMessage)) {
assertTrue("received message if of wrong type, should be TextMessage but is '" + msg2.getClass().getName() + "'", false);
}
assertEquals("receive(): messages are not the same", msgIn[i].getText(), ((TextMessage)msg2).getText());
}