Author: markt
Date: Tue Apr 12 18:35:00 2016
New Revision: 1738844

URL: http://svn.apache.org/viewvc?rev=1738844&view=rev
Log:
Sync failing (with APR on Gump) test with trunk to add possible work-around

Modified:
    tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java

Modified: 
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java?rev=1738844&r1=1738843&r2=1738844&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java 
(original)
+++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/server/TestClose.java 
Tue Apr 12 18:35:00 2016
@@ -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);
@@ -284,8 +283,20 @@ public class TestClose extends TomcatBas
 
             if (events.onMessageSends) {
                 try {
+                    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");
-                } catch (IOException e) {
+                        Thread.sleep(500);
+                    }
+                } catch (IOException | InterruptedException e) {
                     // Expected to fail
                 }
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to