As HTTP/2 adoption is already done by some of the web servers and the browsers, its time for developers to adopt HTTP client libraries to support HTTP/2. I came across “OkHttp” Java client with Http/2 support.
OkHttp supports by default,
- Uses a single TCP socket for all the requests.
- Supports for both synchronous blocking and asynchronous nonblocking calls.
- Silently handles the common connection problems. If the services hosted in multiple IP addresses, OkHttp client checks for other alternate IP addresses if the first address fails to respond.
Here we will see an example for GET request and POST request.
Now we will see POST request.
The source code created for the above example is available on GitHub.
Leave a Reply