Custom timeouts can be set using the `connectTimeout` method.
Configuring a custom timeout helps manage application responsiveness under varying network conditions. In HttpClient, `connectTimeout` lets you specify how long to wait for a connection. For instance, setting a 2-second timeout: `HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(2)).build();`.