Skip to content
Sharp

Networking · interview question

How can you safely handle a network call timeout using HttpClient in Java?

Multiple choiceHardchapter-11-curatedpremiumnetworkingjackson-objectmapper
Choose one answer
Answer and explanation

Correct answer

B. Configure a timeout using HttpRequest.Builder's timeout method.

Why

HttpRequest.Builder provides a timeout method that allows you to specify the maximum duration to wait for a response, enabling you to handle scenarios where a server takes too long to respond.

Test yourself on Networking

A free test with instant, explained results. No account needed.

Start free test
All Networking questions →