HttpClient Examples (Async)

  • Asynchronous HTTP exchange

    This example demonstrates a basic asynchronous HTTP request / response exchange. Response content is buffered in memory for simplicity.

  • Asynchronous HTTP exchange with content streaming

    This example demonstrates an asynchronous HTTP request / response exchange with a full content streaming.

  • HTTP/2 ALPN support

    This example demonstrates how to avoid the illegal reflective access operation warning when running with Oracle JRE 9 or newer.

  • Pipelined HTTP/1.1 exchanges

    This example demonstrates a pipelined execution of multiple HTTP/1.1 request / response exchanges. Response content is buffered in memory for simplicity.

  • Multiplexed HTTP/2 exchanges

    This example demonstrates a multiplexed execution of multiple HTTP/2 request / response exchanges. Response content is buffered in memory for simplicity.

  • Request execution interceptors

    This example demonstrates how to insert custom request interceptor and an execution interceptor to the request execution chain.

  • Message trailers

    This example demonstrates how to use a custom execution interceptor to add trailers to all outgoing request enclosing an entity..

  • Multiplexed HTTP/2 exchanges

This example demonstrates handling of HTTP/2 message exchanges pushed by the server.

  • Client authentication

    This example demonstrates execution of an HTTP request against a target site that requires user authentication.

  • Custom SSL context

    This example demonstrates how to create secure connections with a custom SSL context.

  • Connection eviction

    This example demonstrates how to evict expired and idle connections from the connection pool.