public void testMultipleSubscribers() throws Exception {
ByteString topic = ByteString.copyFromUtf8("multiSubTopic");
Client client = new HedwigClient(new HubClientConfiguration());
Publisher pub = client.getPublisher();
Subscriber sub = client.getSubscriber();
SubscriptionOptions options5 = SubscriptionOptions.newBuilder()
.setCreateOrAttach(CreateOrAttach.CREATE).setMessageBound(5).build();
SubscriptionOptions options20 = SubscriptionOptions.newBuilder()
.setCreateOrAttach(CreateOrAttach.CREATE).setMessageBound(20).build();
SubscriptionOptions optionsUnbounded = SubscriptionOptions.newBuilder()
.setCreateOrAttach(CreateOrAttach.CREATE).build();
ByteString subid5 = ByteString.copyFromUtf8("bound5SubId");
ByteString subid20 = ByteString.copyFromUtf8("bound20SubId");
ByteString subidUnbounded = ByteString.copyFromUtf8("noboundSubId");
sub.subscribe(topic, subid5, options5);
sub.closeSubscription(topic, subid5);
sendXExpectLastY(pub, sub, topic, subid5, 1000, 5);
sub.subscribe(topic, subid20, options20);
sub.closeSubscription(topic, subid20);
sendXExpectLastY(pub, sub, topic, subid20, 1000, 20);
sub.subscribe(topic, subidUnbounded, optionsUnbounded);
sub.closeSubscription(topic, subidUnbounded);
sendXExpectLastY(pub, sub, topic, subidUnbounded, 10000, 10000);
sub.unsubscribe(topic, subidUnbounded);
sendXExpectLastY(pub, sub, topic, subid20, 1000, 20);
sub.unsubscribe(topic, subid20);
sendXExpectLastY(pub, sub, topic, subid5, 1000, 5);
sub.unsubscribe(topic, subid5);
client.close();
}