Skip to content
Sharp

Networking · interview question

Which method on the HttpClient.Builder allows setting the connect timeout?

Multiple choiceEasychapter-11-curatedpremiumnetworkingtimeouts-and-retries
Choose one answer
Answer and explanation

Correct answer

D. ConnectTimeout(Duration.ofSeconds(10))

Why

The method connectTimeout(Duration) on HttpClient.Builder is used to set the time limit for establishing a connection, expressed as a Duration object. This is essential for managing how long the client waits to connect to a server.

Test yourself on Networking

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

Start free test
All Networking questions →