Author: rjung Date: Wed Dec 18 13:16:54 2013 New Revision: 1551933 URL: http://svn.apache.org/r1551933 Log: - Add a 100 ms sleep to allow for the server side to handle the request the client generated before checking for the side-effects - Clean up subprotocols at end of test to keep the two tests independent of each other
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java?rev=1551933&r1=1551932&r2=1551933&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsSubprotocols.java Wed Dec 18 13:16:54 2013 @@ -72,11 +72,17 @@ public class TestWsSubprotocols extends .build(), new URI("ws://localhost:" + getPort() + SubProtocolsEndpoint.PATH_BASIC)); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // Ignore + } Assert.assertTrue(wsSession.isOpen()); if (wsSession.getNegotiatedSubprotocol() != null) { Assert.assertTrue(wsSession.getNegotiatedSubprotocol().isEmpty()); } wsSession.close(); + SubProtocolsEndpoint.recycle(); wsSession = wsContainer.connectToServer( TesterProgrammaticEndpoint.class, ClientEndpointConfig.Builder @@ -84,11 +90,17 @@ public class TestWsSubprotocols extends .build(), new URI("ws://localhost:" + getPort() + SubProtocolsEndpoint.PATH_BASIC)); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + // Ignore + } Assert.assertTrue(wsSession.isOpen()); Assert.assertEquals("sp2", wsSession.getNegotiatedSubprotocol()); Assert.assertArrayEquals(new String[]{"sp1","sp2"}, SubProtocolsEndpoint.subprotocols.toArray(new String[2])); wsSession.close(); + SubProtocolsEndpoint.recycle(); } @ServerEndpoint(value = "/echo", subprotocols = {"sp1","sp2"}) @@ -102,6 +114,10 @@ public class TestWsSubprotocols extends subprotocols = ((ServerEndpointConfig)epc).getSubprotocols(); } + public static void recycle() { + subprotocols = null; + } + } public static class Config extends WsContextListener { @@ -118,4 +134,4 @@ public class TestWsSubprotocols extends } } } -} \ No newline at end of file +} --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org