if (reply.status == HTTP_NOT_FOUND && !decodeableStatusCodes.contains(HTTP_NOT_FOUND)) {
return immediateFuture(null);
}
if (!decodeableStatusCodes.contains(reply.status)) {
throw new HeliosException("request failed: " + reply);
}
if (reply.payload.length == 0) {
throw new HeliosException("bad reply: " + reply);
}
final T result;
try {
result = Json.read(reply.payload, javaType);
} catch (IOException e) {
throw new HeliosException("bad reply: " + reply, e);
}
return immediateFuture(result);
}