This is an automated email from the ASF dual-hosted git repository.

dsoumis pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit dd445c65dd2ee793c0320c9c96dc7a3daba9579f
Author: Dimitris Soumis <[email protected]>
AuthorDate: Wed Apr 1 13:32:37 2026 +0300

    Section 5.2.2 of Jakarta WebSocket specification requires that all errors 
arising during the functioning of a WebSocket endpoint must be reported via the 
error handling method, onError(). A TCP reset causes an IOException when the 
server attempts to read from the connection, which qualifies as such an error.
---
 test/org/apache/tomcat/websocket/server/TestClose.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/org/apache/tomcat/websocket/server/TestClose.java 
b/test/org/apache/tomcat/websocket/server/TestClose.java
index 8980ca8778..317fa7303d 100644
--- a/test/org/apache/tomcat/websocket/server/TestClose.java
+++ b/test/org/apache/tomcat/websocket/server/TestClose.java
@@ -46,7 +46,7 @@ import org.apache.tomcat.websocket.WebSocketBaseTest;
  */
 public class TestClose extends WebSocketBaseTest {
 
-    private static Log log = LogFactory.getLog(TestClose.class);
+    private static final Log log = LogFactory.getLog(TestClose.class);
 
     // These are static because it is simpler than trying to inject them into
     // the endpoint
@@ -132,7 +132,9 @@ public class TestClose extends WebSocketBaseTest {
         client.httpUpgrade(BaseEndpointConfig.PATH);
         client.forceCloseSocket();
 
-        // TODO: I'm not entirely sure when onError should be called
+        // A TCP reset causes an IOException when the server reads from
+        // the connection. Per WSC-5.2.2-2, errors arising during the
+        // functioning of the endpoint must be reported via onError.
         awaitOnError(IOException.class);
         awaitOnClose(CloseCodes.CLOSED_ABNORMALLY);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to