Author: markt
Date: Thu Apr 25 19:42:26 2013
New Revision: 1475928

URL: http://svn.apache.org/r1475928
Log:
Fix failing WebSocket unit tests after session closure refactoring

Modified:
    tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java

Modified: 
tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1475928&r1=1475927&r2=1475928&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java 
Thu Apr 25 19:42:26 2013
@@ -264,6 +264,18 @@ public class TestWsWebSocketContainer ex
                         messages.get(0));
             }
         } else {
+            // When the message exceeds the buffer size, the WebSocket is
+            // closed. The endpoint ensures that the latch is cleared when the
+            // WebSocket closes. However, the session isn't marked as closed
+            // until after the onClose() method completes so there is a small
+            // window where this test could fail. Therefore, wait briefly to
+            // give the session a chance to complete the close process.
+            for (int i = 0; i < 500; i++) {
+                if (!wsSession.isOpen()) {
+                    break;
+                }
+                Thread.sleep(10);
+            }
             Assert.assertFalse(wsSession.isOpen());
         }
     }



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

Reply via email to