You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/12/11 21:26:48 UTC
svn commit: r1719531 -
/tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java
Author: markt
Date: Fri Dec 11 20:26:48 2015
New Revision: 1719531
URL: http://svn.apache.org/viewvc?rev=1719531&view=rev
Log:
Make the tests more robust to timing differences across connectors and platforms.
Modified:
tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java
Modified: tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java?rev=1719531&r1=1719530&r2=1719531&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java (original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/server/TestClose.java Fri Dec 11 20:26:48 2015
@@ -51,7 +51,6 @@ import org.apache.juli.logging.LogFactor
/**
* Test the behavior of closing websockets under various conditions.
*/
-//@Ignore // Only because they don't pass at the moment.
public class TestClose extends TomcatBaseTest {
private static Log log = LogFactory.getLog(TestClose.class);
@@ -82,7 +81,7 @@ public class TestClose extends TomcatBas
private static void awaitLatch(CountDownLatch latch, String failMessage) {
try {
- if (!latch.await(3000, TimeUnit.MILLISECONDS)) {
+ if (!latch.await(10000, TimeUnit.MILLISECONDS)) {
Assert.fail(failMessage);
}
} catch (InterruptedException e) {
@@ -281,8 +280,20 @@ public class TestClose extends TomcatBas
if (events.onMessageSends) {
try {
- session.getBasicRemote().sendText("Test reply");
- } catch (IOException e) {
+ int count = 0;
+ // The latches above are meant to ensure the correct
+ // sequence of events but in some cases, particularly with
+ // APR, there is a short delay between the client closing /
+ // resetting the connection and the server recognising that
+ // fact. This loop tries to ensure that it lasts much longer
+ // than that delay so any close / reset from the client
+ // triggers an error here.
+ while (count < 10) {
+ count++;
+ session.getBasicRemote().sendText("Test reply");
+ Thread.sleep(500);
+ }
+ } catch (IOException | InterruptedException e) {
// Expected to fail
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org