connection.subscribe(new Topic[]{new Topic("#", QoS.AT_LEAST_ONCE)});
for (int i = 0; i < 4; i++) {
final Message message = connection.receive(30, TimeUnit.SECONDS);
assertNotNull("Should receive 4 messages", message);
message.ack();
}
assertEquals("Should receive 2 retained messages", 2, retain[0]);
assertEquals("Should receive 2 non-retained messages", 2, nonretain[0]);
}