{
ClientRequest request = new ClientRequest(generateURL("/topics/testQueue"));
ClientResponse response = request.head();
Assert.assertEquals(200, response.getStatus());
Link sender = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "create");
System.out.println("create: " + sender);
Link subscriptions = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "pull-subscriptions");
response = subscriptions.request().formParameter("autoAck", "false")
.formParameter("durable", "true")
.post();
Assert.assertEquals(201, response.getStatus());
Link sub1 = response.getLocation();
Assert.assertNotNull(sub1);
Link consumeNext = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), response, "acknowledge-next");
System.out.println("poller: " + consumeNext);
ClientResponse<String> res = consumeNext.request().post(String.class);
Assert.assertEquals(503, res.getStatus());
consumeNext = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledge-next");
System.out.println(consumeNext);
Assert.assertEquals(201, sender.request().body("text/plain", Integer.toString(1)).post().getStatus());
res = consumeNext.request().post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals(Integer.toString(1), res.getEntity());
Link ack = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
ClientResponse ackRes = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(204, ackRes.getStatus());
Assert.assertEquals(503, consumeNext.request().post().getStatus());
Assert.assertEquals(201, sender.request().body("text/plain", Integer.toString(2)).post().getStatus());
Assert.assertEquals(201, sender.request().body("text/plain", Integer.toString(3)).post().getStatus());
res = consumeNext.request().post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals(Integer.toString(2), res.getEntity());
ack = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(204, ackRes.getStatus());
res = consumeNext.request().post(String.class);
Assert.assertEquals(200, res.getStatus());
Assert.assertEquals(Integer.toString(3), res.getEntity());
ack = MessageTestBase.getLinkByTitle(manager.getTopicManager().getLinkStrategy(), res, "acknowledgement");
System.out.println("ack: " + ack);
ackRes = ack.request().formParameter("acknowledge", "true").post();
Assert.assertEquals(204, ackRes.getStatus());
Assert.assertEquals(503, consumeNext.request().post().getStatus());
Assert.assertEquals(204, sub1.request().delete().getStatus());