@@ -203,6 +203,36 @@ void shouldAllowConfigurationOfRequestTimeout() {
203203 ClientConfig .defaultConfig ().readTimeout (Duration .ofMillis (500 ))));
204204 }
205205
206+ @ Test
207+ public void shouldAllowConfigurationFromSystemProperties () {
208+ delegate =
209+ req -> {
210+ try {
211+ Thread .sleep (1100 );
212+ } catch (InterruptedException e ) {
213+ throw new RuntimeException (e );
214+ }
215+ return new HttpResponse ().setContent (Contents .utf8String ("Connection timed out" ));
216+ };
217+ try {
218+ System .setProperty ("webdriver.httpclient.connectionTimeout" , "1" );
219+ System .setProperty ("webdriver.httpclient.readTimeout" , "300" );
220+ System .setProperty ("webdriver.httpclient.version" , "HTTP_1_1" );
221+ ClientConfig clientConfig = ClientConfig .defaultConfig ();
222+ assertThat (clientConfig .connectionTimeout ()).isEqualTo (Duration .ofSeconds (1 ));
223+ assertThat (clientConfig .readTimeout ()).isEqualTo (Duration .ofSeconds (300 ));
224+ assertThat (clientConfig .version ()).isEqualTo ("HTTP_1_1" );
225+ HttpClient client =
226+ createFactory ().createClient (clientConfig .baseUri (URI .create (server .whereIs ("/" ))));
227+ HttpRequest request = new HttpRequest (GET , "/delayed" );
228+ assertThatExceptionOfType (TimeoutException .class ).isThrownBy (() -> client .execute (request ));
229+ } finally {
230+ System .clearProperty ("webdriver.httpclient.connectionTimeout" );
231+ System .clearProperty ("webdriver.httpclient.readTimeout" );
232+ System .clearProperty ("webdriver.httpclient.version" );
233+ }
234+ }
235+
206236 private HttpResponse getResponseWithHeaders (final Multimap <String , String > headers ) {
207237 return executeWithinServer (
208238 new HttpRequest (GET , "/foo" ),
0 commit comments