@@ -80,13 +80,17 @@ public class JdkHttpClient implements HttpClient {
8080 private final ExecutorService executorService ;
8181 private final Duration readTimeout ;
8282 private final Duration connectTimeout ;
83+ private final Duration webSocketTimeout ;
84+ private final Duration webSocketInterval ;
8385
8486 JdkHttpClient (ClientConfig config ) {
8587 Objects .requireNonNull (config , "Client config must be set" );
8688
8789 this .messages = new JdkHttpMessages (config );
8890 this .readTimeout = config .readTimeout ();
8991 this .connectTimeout = config .connectionTimeout ();
92+ this .webSocketTimeout = config .webSocketTimeout ();
93+ this .webSocketInterval = config .webSocketInterval ();
9094 this .websockets = new ArrayList <>();
9195 this .handler = config .filter ().andFinally (this ::execute0 );
9296
@@ -244,7 +248,7 @@ public void onError(java.net.http.WebSocket webSocket, Throwable error) {
244248
245249 try {
246250 underlyingSocket =
247- webSocketCompletableFuture .get (readTimeout .toMillis (), TimeUnit .MILLISECONDS );
251+ webSocketCompletableFuture .get (webSocketTimeout .toMillis (), TimeUnit .MILLISECONDS );
248252 } catch (CancellationException e ) {
249253 throw new ConnectionFailedException ("JdkWebSocket initial request canceled" , e );
250254 } catch (ExecutionException e ) {
@@ -314,7 +318,7 @@ public WebSocket send(Message message) {
314318 long start = System .currentTimeMillis ();
315319 CompletableFuture <java .net .http .WebSocket > future = makeCall .get ();
316320 try {
317- future .get (readTimeout .toMillis (), TimeUnit .MILLISECONDS );
321+ future .get (webSocketTimeout .toMillis (), TimeUnit .MILLISECONDS );
318322 } catch (CancellationException e ) {
319323 throw new WebDriverException (e .getMessage (), e );
320324 } catch (ExecutionException e ) {
0 commit comments