|
17 | 17 |
|
18 | 18 | package org.openqa.selenium.grid.sessionqueue.remote; |
19 | 19 |
|
| 20 | +import static org.openqa.selenium.remote.http.ClientConfig.defaultConfig; |
20 | 21 | import static org.openqa.selenium.remote.http.HttpMethod.DELETE; |
21 | 22 | import static org.openqa.selenium.remote.http.HttpMethod.GET; |
22 | 23 | import static org.openqa.selenium.remote.http.HttpMethod.POST; |
|
25 | 26 | import java.lang.reflect.Type; |
26 | 27 | import java.net.MalformedURLException; |
27 | 28 | import java.net.URI; |
| 29 | +import java.time.Duration; |
28 | 30 | import java.util.HashMap; |
29 | 31 | import java.util.List; |
30 | 32 | import java.util.Map; |
|
48 | 50 | import org.openqa.selenium.internal.Require; |
49 | 51 | import org.openqa.selenium.json.Json; |
50 | 52 | import org.openqa.selenium.json.TypeToken; |
| 53 | +import org.openqa.selenium.remote.http.ClientConfig; |
51 | 54 | import org.openqa.selenium.remote.http.Contents; |
52 | 55 | import org.openqa.selenium.remote.http.Filter; |
53 | 56 | import org.openqa.selenium.remote.http.HttpClient; |
@@ -77,14 +80,17 @@ public RemoteNewSessionQueue(Tracer tracer, HttpClient client, Secret registrati |
77 | 80 | public static NewSessionQueue create(Config config) { |
78 | 81 | Tracer tracer = new LoggingOptions(config).getTracer(); |
79 | 82 | URI uri = new NewSessionQueueOptions(config).getSessionQueueUri(); |
| 83 | + Duration sessionRequestTimeout = new NewSessionQueueOptions(config).getSessionRequestTimeout(); |
80 | 84 | HttpClient.Factory clientFactory = new NetworkOptions(config).getHttpClientFactory(tracer); |
81 | 85 |
|
82 | 86 | SecretOptions secretOptions = new SecretOptions(config); |
83 | 87 | Secret registrationSecret = secretOptions.getRegistrationSecret(); |
84 | 88 |
|
85 | 89 | try { |
| 90 | + ClientConfig clientConfig = |
| 91 | + defaultConfig().readTimeout(sessionRequestTimeout).baseUrl(uri.toURL()); |
86 | 92 | return new RemoteNewSessionQueue( |
87 | | - tracer, clientFactory.createClient(uri.toURL()), registrationSecret); |
| 93 | + tracer, clientFactory.createClient(clientConfig), registrationSecret); |
88 | 94 | } catch (MalformedURLException e) { |
89 | 95 | throw new UncheckedIOException(e); |
90 | 96 | } |
|
0 commit comments