public static void main(final String[] args) throws Exception {
        try (final CloseableHttpClient httpclient = HttpAsyncClients.classic(
                HttpAsyncClients.createDefault(),
                Timeout.ofMinutes(1))) {
            final HttpGet httpget = new HttpGet("http://httpbin.org/get");
            System.out.println("Executing request " + httpget.getMethod() + " " + httpget.getUri());
            httpclient.execute(httpget, response -> {
                System.out.println("----------------------------------------");
                System.out.println(httpget + "->" + new StatusLine(response));
                final HttpEntity entity = response.getEntity();
                if (entity != null) {
                    final ContentType contentType = ContentType.parseLenient(entity.getContentType());
                    final Charset charset = ContentType.getCharset(contentType, StandardCharsets.UTF_8);
                    try (BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent(), charset))) {
                        String line;
                        while ((line = reader.readLine()) != null) {
                            System.out.println(line);
                        }
                    }
                }
                return null;
            });
        }
    }
This example demonstrates create an {@link CloseableHttpClient} adaptor over
{@link CloseableHttpAsyncClient} providing compatibility with the classic APIs
based on the {@link java.io.InputStream} / {@link java.io.OutputStream} model
httpclient5/src/test/java/org/apache/hc/client5/http/examples/ClientClassicOverAsync.java