assertTrue("Expected message '" + httpMessage + "', instead found " + resp_message, resp_message.equals(httpMessage));
ReceiveMessageRequest receiveMessageRequest = new ReceiveMessageRequest();
receiveMessageRequest.setQueueUrl(queueUrl);
ReceiveMessageResult result = cqs1.receiveMessage(receiveMessageRequest);
assertTrue("No message found", result.getMessages().size() > 0);
String msg = result.getMessages().get(0).getBody();
assertTrue("Expected message '" + cqsMessage + "', instead found " + resp_message, msg.contains(cqsMessage));
String receiptHandle = result.getMessages().get(0).getReceiptHandle();
assertTrue("Receipt handle is null", receiptHandle != null);
DeleteMessageRequest deleteMessageRequest = new DeleteMessageRequest();
deleteMessageRequest.setQueueUrl(queueUrl);
deleteMessageRequest.setReceiptHandle(receiptHandle);
cqs1.deleteMessage(deleteMessageRequest);
httpMessage = "test Http servlet 45554";
cqsMessage = "test CQS servlet 2758";
message = CNSTestingUtils.generateMultiendpointMessageJson(null, null, "test message", httpMessage, null, cqsMessage);
publishRequest = new PublishRequest();
publishRequest.setMessageStructure(messageStructure);
publishRequest.setMessage(message);
publishRequest.setTopicArn(topicArn);
cns1.publish(publishRequest);
Thread.sleep(1000);
resp = CNSTestingUtils.sendHttpMessage(lastMessageUrl, "");
json = new JSONObject(resp);
resp_message = json.getString("Message");
assertTrue("Expected message '" + httpMessage + "', instead found " + resp_message, resp_message.contains(httpMessage));
receiveMessageRequest = new ReceiveMessageRequest();
receiveMessageRequest.setQueueUrl(queueUrl);
result = cqs1.receiveMessage(receiveMessageRequest);
assertTrue("No message found", result.getMessages().size() > 0);
msg = result.getMessages().get(0).getBody();
assertTrue("Expected message '" + cqsMessage + "', instead found " + resp_message, msg.contains(cqsMessage));
receiptHandle = result.getMessages().get(0).getReceiptHandle();
assertTrue("Receipt handle is null", receiptHandle != null);
deleteMessageRequest = new DeleteMessageRequest();
deleteMessageRequest.setQueueUrl(queueUrl);
deleteMessageRequest.setReceiptHandle(receiptHandle);