for (int i=0; i<numMessages; i++) {
String str = prefix + i;
ByteString data = ByteString.copyFromUtf8(str);
Message msg = Message.newBuilder().setBody(data).build();
PublishResponse response = publisher.publish(topic, msg);
assertNotNull(response);
publishedMsgs.put(str, response.getPublishedMsgId());
}
assertTrue("Timed out waiting on callback for messages.",
receiveLatch.await(30, TimeUnit.SECONDS));
assertEquals("Should be expected " + numMessages + " messages.",