Merge branch 'jetty-10.0.x-3696-connectToServer-ExecutionException' of https://github.com/lachlan-roberts/jetty.project into lachlan-roberts-jetty-10.0.x-3696-connectToServer-ExecutionException
This commit is contained in:
commit
3d20d9c51a
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -148,6 +149,10 @@ public class JavaxWebSocketClientContainer extends JavaxWebSocketContainer imple
|
|||
return sessionFuture.get(timeout+1000, TimeUnit.MILLISECONDS);
|
||||
return sessionFuture.get();
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
{
|
||||
throw new IOException("Connection future not completed " + destURI, e.getCause());
|
||||
}
|
||||
catch (TimeoutException e)
|
||||
{
|
||||
throw new IOException("Connection future not completed " + destURI, e);
|
||||
|
|
|
@ -26,6 +26,7 @@ import javax.websocket.ContainerProvider;
|
|||
import javax.websocket.WebSocketContainer;
|
||||
|
||||
import org.eclipse.jetty.util.log.StacklessLogging;
|
||||
import org.eclipse.jetty.websocket.core.CloseException;
|
||||
import org.eclipse.jetty.websocket.core.internal.WebSocketCoreSession;
|
||||
import org.eclipse.jetty.websocket.javax.tests.CoreServer;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
|
@ -76,7 +77,7 @@ public class MisbehavingClassTest
|
|||
{
|
||||
// expecting IOException during onOpen
|
||||
Exception e = assertThrows(IOException.class, () -> container.connectToServer(socket, server.getWsUri()), "Should have failed .connectToServer()");
|
||||
assertThat(e.getCause(), instanceOf(ExecutionException.class));
|
||||
assertThat(e.getCause(), instanceOf(CloseException.class));
|
||||
|
||||
assertThat("Close should have occurred", socket.closeLatch.await(1, TimeUnit.SECONDS), is(true));
|
||||
|
||||
|
@ -97,7 +98,7 @@ public class MisbehavingClassTest
|
|||
{
|
||||
// expecting IOException during onOpen
|
||||
Exception e = assertThrows(IOException.class, () -> container.connectToServer(socket, server.getWsUri()), "Should have failed .connectToServer()");
|
||||
assertThat(e.getCause(), instanceOf(ExecutionException.class));
|
||||
assertThat(e.getCause(), instanceOf(CloseException.class));
|
||||
|
||||
assertThat("Close should have occurred", socket.closeLatch.await(5, TimeUnit.SECONDS), is(true));
|
||||
|
||||
|
|
Loading…
Reference in New Issue