Issue #5018 - rename ClientUpgradeRequest timeout to setTimeout
and increase timeouts used for testing Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
74916c2fc9
commit
702a48c2d1
|
@ -100,7 +100,7 @@ public class ClientTimeoutTest
|
|||
client.setMaxIdleTimeout(timeout);
|
||||
Future<Session> connect = client.connect(clientSocket, WSURI.toWebsocket(server.getURI()));
|
||||
|
||||
ExecutionException executionException = assertThrows(ExecutionException.class, () -> connect.get(timeout + 200, TimeUnit.MILLISECONDS));
|
||||
ExecutionException executionException = assertThrows(ExecutionException.class, () -> connect.get(timeout * 2, TimeUnit.MILLISECONDS));
|
||||
assertThat(executionException.getCause(), instanceOf(UpgradeException.class));
|
||||
UpgradeException upgradeException = (UpgradeException)executionException.getCause();
|
||||
assertThat(upgradeException.getCause(), instanceOf(TimeoutException.class));
|
||||
|
@ -112,10 +112,10 @@ public class ClientTimeoutTest
|
|||
EventSocket clientSocket = new EventSocket();
|
||||
long timeout = 1000;
|
||||
ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
|
||||
upgradeRequest.timeout(timeout, TimeUnit.MILLISECONDS);
|
||||
upgradeRequest.setTimeout(timeout, TimeUnit.MILLISECONDS);
|
||||
Future<Session> connect = client.connect(clientSocket, WSURI.toWebsocket(server.getURI()), upgradeRequest);
|
||||
|
||||
ExecutionException executionException = assertThrows(ExecutionException.class, () -> connect.get(timeout + 200, TimeUnit.MILLISECONDS));
|
||||
ExecutionException executionException = assertThrows(ExecutionException.class, () -> connect.get(timeout * 2, TimeUnit.MILLISECONDS));
|
||||
assertThat(executionException.getCause(), instanceOf(UpgradeException.class));
|
||||
UpgradeException upgradeException = (UpgradeException)executionException.getCause();
|
||||
assertThat(upgradeException.getCause(), instanceOf(TimeoutException.class));
|
||||
|
|
|
@ -185,12 +185,10 @@ public class ClientUpgradeRequest extends UpgradeRequestAdapter
|
|||
* @param timeout the total timeout for the request/response conversation of the WebSocket handshake;
|
||||
* use zero or a negative value to disable the timeout
|
||||
* @param unit the timeout unit
|
||||
* @return this request object
|
||||
*/
|
||||
public ClientUpgradeRequest timeout(long timeout, TimeUnit unit)
|
||||
public void setTimeout(long timeout, TimeUnit unit)
|
||||
{
|
||||
this.timeout = unit.toMillis(timeout);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue