Code first
ByteBuffer readBuffer = ByteBuffer.allocate(requestSize);// here is 1024*1024*1024 = 1G readBuffer.clear()