MessageStream messageStream = messageApi.stream(limit(2));
while (messageStream.nextMarker().isPresent()) {
assertEquals(Iterables.size(messageStream), 2);
messageStream = messageApi.stream(messageStream.nextStreamOptions());
}
assertFalse(messageStream.nextMarker().isPresent());
assertEquals(server.getRequestCount(), 5);