try {
Representation entity = resource.get();
System.out.println("Status: " + resource.getStatus());
long expectedSize = entity.getSize();
long receivedSize = entity.exhaust();
System.out.println("Size expected: " + expectedSize);
System.out.println("Size consumed: " + receivedSize);
if ((expectedSize != -1) && (expectedSize != receivedSize)) {