@@ -15,6 +15,7 @@ public class SocketLabsClient implements SocketLabsClientAPI {
15
15
private String apiKey ;
16
16
private String endPointUrl = "https://inject.socketlabs.com/api/v1/email" ;
17
17
private Proxy proxy ;
18
+ private int requestTimeout = 100 ;
18
19
19
20
/**
20
21
* Set the SocketLabs Injection API endpoint Url
@@ -24,6 +25,12 @@ public void setEndPointUrl(String value) {
24
25
this .endPointUrl = value ;
25
26
}
26
27
28
+ /**
29
+ * Set the Timeout period used by the HttpClient (in seconds)
30
+ * @param value int
31
+ */
32
+ public void setRequestTimeout (int value ) { this .requestTimeout = value ; }
33
+
27
34
private final String VERSION = "1.0.0" ;
28
35
private final String userAgent = String .format ("SocketLabs-java/%s(%s)" , VERSION , Package .getPackage ("java.util" ).getImplementationVersion ());
29
36
@@ -36,6 +43,7 @@ public SocketLabsClient(int serverId, String apiKey) {
36
43
this .serverId = serverId ;
37
44
this .apiKey = apiKey ;
38
45
}
46
+
39
47
/**
40
48
*
41
49
* Creates a new instance of the SocketLabsClient.
@@ -159,7 +167,7 @@ private SendResponse Validate(BulkMessage message) {
159
167
160
168
private HttpRequest buildHttpRequest (Proxy optionalProxy ) {
161
169
162
- HttpRequest request = new HttpRequest (HttpRequest .HttpRequestMethod .POST , this .endPointUrl );
170
+ HttpRequest request = new HttpRequest (HttpRequest .HttpRequestMethod .POST , this .endPointUrl , this . requestTimeout );
163
171
164
172
request .setHeader ("User-Agent" , this .userAgent );
165
173
request .setHeader ("content-type" , "application/json" );
0 commit comments