diff --git a/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java b/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java
index 183c59d4..22204171 100644
--- a/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java
+++ b/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java
@@ -21,6 +21,7 @@
import java.net.*;
import java.net.http.*;
+import java.time.*;
import java.util.*;
import java.util.logging.*;
@@ -44,7 +45,9 @@ public class AwsCandidateHarvester
* The HttpClient used by the AwsCandidateHarvester
* class and its instances for making requests to IMDS.
*/
- private static final HttpClient httpClient = HttpClient.newHttpClient();
+ private static final HttpClient httpClient = HttpClient.newBuilder()
+ .connectTimeout(Duration.ofMillis(500))
+ .build();
/**
* The URL where one obtains AWS public addresses.