try {
MarconiApi api = api(server.getUrl("/").toString(), "openstack-marconi");
MessageApi messageApi = api.getMessageApiForZoneAndClientAndQueue("DFW", CLIENT_ID, "jclouds-test");
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);
assertEquals(server.takeRequest().getRequestLine(), "POST /tokens HTTP/1.1");
assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages?limit=2 HTTP/1.1");
assertEquals(server.takeRequest().getRequestLine(), "GET /v1/123123/queues/jclouds-test/messages?marker=4508&limit=2 HTTP/1.1");