try {
File largeFile = createTempFile(1024 * 100 * 10);
final AtomicInteger byteReceived = new AtomicInteger();
try {
Response response = c.preparePut(getTargetUrl()).setBody(largeFile).execute(new AsyncCompletionHandlerAdapter() {
@Override
public STATE onBodyPartReceived(final HttpResponseBodyPart content) throws Exception {
byteReceived.addAndGet(content.getBodyByteBuffer().capacity());
return super.onBodyPartReceived(content);
}