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

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


The following commit(s) were added to refs/heads/11.0.x by this push:
     new c6187ca2b8 Speed up test execution
c6187ca2b8 is described below

commit c6187ca2b820e3164b01295bb87a2577ed88aa5f
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Jan 31 15:35:09 2025 +0000

    Speed up test execution
---
 test/org/apache/tomcat/websocket/server/TestSlowClient.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/test/org/apache/tomcat/websocket/server/TestSlowClient.java 
b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
index a9203609f5..b45f0b4698 100644
--- a/test/org/apache/tomcat/websocket/server/TestSlowClient.java
+++ b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
@@ -19,6 +19,8 @@ package org.apache.tomcat.websocket.server;
 import java.net.URI;
 
 import jakarta.websocket.ClientEndpointConfig;
+import jakarta.websocket.CloseReason;
+import jakarta.websocket.CloseReason.CloseCodes;
 import jakarta.websocket.ContainerProvider;
 import jakarta.websocket.MessageHandler;
 import jakarta.websocket.Session;
@@ -34,6 +36,7 @@ import org.apache.coyote.AbstractProtocol;
 import org.apache.tomcat.websocket.TesterFirehoseServer;
 import 
org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEndpoint;
 import org.apache.tomcat.websocket.WebSocketBaseTest;
+import org.apache.tomcat.websocket.WsSession;
 
 public class TestSlowClient extends WebSocketBaseTest {
 
@@ -70,10 +73,10 @@ public class TestSlowClient extends WebSocketBaseTest {
             count++;
         }
         Assert.assertTrue(wsSession.isOpen());
-        // Set a short session close timeout (milliseconds)
-        wsSession.getUserProperties().put(
-            
org.apache.tomcat.websocket.Constants.SESSION_CLOSE_TIMEOUT_PROPERTY, 
Long.valueOf(2000));
-        wsSession.close();
+
+        // Cast so we can force the session to be closed quickly.
+        CloseReason cr = new CloseReason(CloseCodes.CLOSED_ABNORMALLY, "");
+        ((WsSession) wsSession).doClose(cr, cr, true);
 
         // BZ 64848 (non-container thread variant)
         // Confirm there are no waiting processors


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

Reply via email to