Skip to content

Commit 1bbba1d

Browse files
author
Derrick Isaacson
committed
change HttpClientFactory error handling
1 parent cc36b9b commit 1bbba1d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: java/client/src/org/openqa/selenium/remote/internal/HttpClientFactory.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,17 @@ public HttpClient getHttpClient() {
8282
}
8383

8484
public CloseableHttpClient createHttpClient(Credentials credentials) {
85-
return createHttpClient(credentials, 0, 0);
85+
return createHttpClient(credentials, TIMEOUT_TWO_MINUTES, TIMEOUT_THREE_HOURS);
8686
}
8787

8888
public CloseableHttpClient createHttpClient(Credentials credentials, int connectionTimeout, int socketTimeout) {
89+
if (connectionTimeout <= 0) {
90+
throw new IllegalArgumentException("connection timeout must be > 0");
91+
}
92+
if (socketTimeout <= 0) {
93+
throw new IllegalArgumentException("socket timeout must be > 0");
94+
}
95+
8996
SocketConfig socketConfig = createSocketConfig(socketTimeout);
9097
RequestConfig requestConfig = createRequestConfig(connectionTimeout, socketTimeout);
9198

0 commit comments

Comments
 (0)