Skip to content

Commit

Permalink
Avoid indefinite wait in JettyWebSocketClient
Browse files Browse the repository at this point in the history
Closes gh-23994
  • Loading branch information
rstoyanchev committed Nov 14, 2019
1 parent 830f812 commit 905e3c1
Showing 1 changed file with 3 additions and 2 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 the original author or authors.
* Copyright 2002-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,6 +22,7 @@
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
Expand Down Expand Up @@ -155,7 +156,7 @@ public ListenableFuture<WebSocketSession> doHandshakeInternal(WebSocketHandler w

Callable<WebSocketSession> connectTask = () -> {
Future<Session> future = this.client.connect(listener, uri, request);
future.get();
future.get(this.client.getConnectTimeout() + 2000, TimeUnit.MILLISECONDS);
return wsSession;
};

Expand Down

0 comments on commit 905e3c1

Please sign in to comment.