final CountDownLatch receiveLatch = new CountDownLatch(1);
final Map<String, MessageSeqId> receivedMsgs =
new HashMap<String, MessageSeqId>();
subscriber.subscribe(topic, subid, CreateOrAttach.CREATE_OR_ATTACH);
subscriber.startDelivery(topic, subid, new MessageHandler() {
synchronized public void deliver(ByteString topic, ByteString subscriberId,
Message msg, Callback<Void> callback,
Object context) {
String str = msg.getBody().toStringUtf8();
receivedMsgs.put(str, msg.getMsgId());