Author: markt
Date: Fri Oct 24 22:47:03 2014
New Revision: 1634150
URL: http://svn.apache.org/r1634150
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=57047
Fix possible false test failure when the session gets closed before the message
write can complete.
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1524984
Modified:
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java?rev=1634150&r1=1634149&r2=1634150&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
(original)
+++
tomcat/tc7.0.x/trunk/test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java
Fri Oct 24 22:47:03 2014
@@ -17,6 +17,7 @@
package org.apache.tomcat.websocket;
import java.io.File;
+import java.io.IOException;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URL;
@@ -255,11 +256,17 @@ public class TestWsWebSocketContainer ex
}
wsSession.addMessageHandler(handler);
- if (isTextMessage) {
- wsSession.getBasicRemote().sendText(MESSAGE_TEXT_4K);
- } else {
- wsSession.getBasicRemote().sendBinary(
- ByteBuffer.wrap(MESSAGE_BINARY_4K));
+ try {
+ if (isTextMessage) {
+ wsSession.getBasicRemote().sendText(MESSAGE_TEXT_4K);
+ } else {
+ wsSession.getBasicRemote().sendBinary(
+ ByteBuffer.wrap(MESSAGE_BINARY_4K));
+ }
+ } catch (IOException ioe) {
+ // Some messages sends are expected to fail. Assertions further on
+ // in this method will check for the correct behaviour so ignore
any
+ // exception here.
}
boolean latchResult = handler.getLatch().await(10, TimeUnit.SECONDS);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]