From 07c287c5cb57c6a8abff08ae7d43a40df4115440 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Wed, 5 Jul 2017 10:26:30 -0700 Subject: [PATCH] Issue #1650 - testcase stability effort (take 5 w/debug) --- .../jetty/cdi/websocket/basicapp/BasicAppTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java index a946c7dab0e..f968ca26ff9 100644 --- a/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java +++ b/jetty-cdi/cdi-websocket/src/test/java/org/eclipse/jetty/cdi/websocket/basicapp/BasicAppTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertThat; import java.io.File; import java.net.URI; +import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import javax.websocket.server.ServerContainer; @@ -36,6 +37,7 @@ import org.eclipse.jetty.util.log.JettyLogHandler; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; +import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.api.util.WSURI; import org.eclipse.jetty.websocket.client.WebSocketClient; @@ -102,10 +104,10 @@ public class BasicAppTest { client.start(); CheckSocket socket = new CheckSocket(); - client.connect(socket,serverWebsocketURI.resolve("/echo")); + Future futureSession = client.connect(socket,serverWebsocketURI.resolve("/echo")); - socket.awaitOpen(5,TimeUnit.SECONDS); - socket.sendText("Hello World"); + Session session = futureSession.get(5, TimeUnit.SECONDS); + session.getRemote().sendString("Hello World"); String response = socket.getTextMessages().poll(5, TimeUnit.SECONDS); assertThat("Message[0]",response,is("Hello World"));