Extracted java code samples for async

Also ensured that files in Java are served as the docs say they are
served, as attachments, with a content length, not chunked.
Merge pull request #1087 from jroper/async-java-docs

Extracted java code samples for async