|
21 | 21 | import static org.openqa.selenium.remote.RemoteTags.SESSION_ID; |
22 | 22 | import static org.openqa.selenium.remote.RemoteTags.SESSION_ID_EVENT; |
23 | 23 | import static org.openqa.selenium.remote.http.Contents.asJson; |
| 24 | +import static org.openqa.selenium.remote.http.Contents.string; |
24 | 25 | import static org.openqa.selenium.remote.http.HttpMethod.GET; |
25 | 26 | import static org.openqa.selenium.remote.tracing.Tags.EXCEPTION; |
26 | 27 | import static org.openqa.selenium.remote.tracing.Tags.HTTP_REQUEST; |
|
48 | 49 | import org.openqa.selenium.grid.data.NodeStatus; |
49 | 50 | import org.openqa.selenium.grid.sessionmap.SessionMap; |
50 | 51 | import org.openqa.selenium.grid.web.ReverseProxyHandler; |
51 | | -import org.openqa.selenium.grid.web.Values; |
52 | 52 | import org.openqa.selenium.internal.Require; |
| 53 | +import org.openqa.selenium.json.Json; |
53 | 54 | import org.openqa.selenium.remote.ErrorCodec; |
54 | 55 | import org.openqa.selenium.remote.SessionId; |
55 | 56 | import org.openqa.selenium.remote.http.ClientConfig; |
@@ -256,10 +257,13 @@ private ClientConfig fetchNodeSessionTimeout(URI uri) { |
256 | 257 | try (HttpClient httpClient = httpClientFactory.createClient(config)) { |
257 | 258 | HttpRequest statusRequest = new HttpRequest(GET, "/se/grid/node/status"); |
258 | 259 | HttpResponse res = httpClient.execute(statusRequest); |
259 | | - NodeStatus nodeStatus = Values.get(res, NodeStatus.class); |
| 260 | + Json json = new Json(); |
| 261 | + NodeStatus nodeStatus = json.toType(string(res), NodeStatus.class); |
260 | 262 | if (nodeStatus != null) { |
261 | 263 | sessionTimeout = nodeStatus.getSessionTimeout(); |
262 | 264 | } |
| 265 | + } catch (Exception e) { |
| 266 | + LOG.fine("Unable to fetch status for " + uri); |
263 | 267 | } |
264 | 268 | LOG.fine("Set read timeout: " + sessionTimeout.toSeconds() + " seconds for " + uri); |
265 | 269 | config = config.readTimeout(sessionTimeout); |
|
0 commit comments