Topic[] topics = {new Topic(utf8("foo"), QoS.AT_LEAST_ONCE)};
subConnection.subscribe(topics);
for (int i = 0; i < 10; i++) {
pubConnection.publish("foo", payload, QoS.AT_LEAST_ONCE, false);
Message message = subConnection.receive();
message.ack();
assertArrayEquals(payload, message.getPayload());
}
subConnection.disconnect();
pubConnection.disconnect();
}