}
@Override
public void send() throws Exception {
HttpAsyncRequester requester = new HttpAsyncRequester(httpProcessor, new DefaultConnectionReuseStrategy(), httpParams);
final URL url = new URL(endpoint);
final HttpHost target = new HttpHost(url.getHost(), url.getPort(), url.getProtocol());
BasicHttpEntityEnclosingRequest request = new BasicHttpEntityEnclosingRequest("POST", url.getPath() + (url.getQuery() == null ? "" : "?" + url.getQuery()));
composeHeader(request);
String msg = null;
if (message.getMessageStructure() == CNSMessageStructure.json) {
msg = message.getProtocolSpecificMessage(CnsSubscriptionProtocol.http);
} else {
msg = message.getMessage();
}
if (!rawMessageDelivery && message.getMessageType() == CNSMessageType.Notification) {
msg = com.comcast.cns.util.Util.generateMessageJson(message, CnsSubscriptionProtocol.http);
}
logger.debug("event=send_async_http_request endpoint=" + endpoint + "\" message=\"" + msg + "\"");
request.setEntity(new NStringEntity(msg));
requester.execute(
new BasicAsyncRequestProducer(target, request),
new BasicAsyncResponseConsumer(),
connectionPool,
new BasicHttpContext(),
new FutureCallback<HttpResponse>() {