if (message != null && message.startsWith("heartbeat-")) {
String identity = (String) getContextValue(res.request(), IDENTITY);
return new Heartbeat(String.valueOf(System.nanoTime()), identity);
} else {
Request swaggerSocketRequest = lookupRequest(res.request());
Response.Builder builder = new Response.Builder();
builder.body(message)
.status(res.getStatus(), res.getStatusMessage());
Map<String, String> headers = res.headers();
for (String s : headers.keySet()) {
builder.header(new Header(s, headers.get(s)));
}
builder.uuid(swaggerSocketRequest.getUuid()).method(swaggerSocketRequest.getMethod())
.path(swaggerSocketRequest.getPath());
String identity = (String) getContextValue(res.request(), IDENTITY);
AtomicInteger expectedResponseCount = (AtomicInteger) getContextValue(res.request(), transactionIdentity.get() + RESPONSE_COUNTER);
ResponseMessage m = null;
if (expectedResponseCount != null && res.resource().transport() != AtmosphereResource.TRANSPORT.WEBSOCKET) {