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

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


The following commit(s) were added to refs/heads/main by this push:
     new 95487f9312 Code clean-up. Formatting. No functional change.
95487f9312 is described below

commit 95487f93128ebc68953416e1a23c47fa61be0212
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Mar 8 18:27:43 2023 +0000

    Code clean-up. Formatting. No functional change.
---
 .../tomcat/websocket/server/TestAsyncMessages.java | 21 +++---
 .../tomcat/websocket/server/TestClassLoader.java   |  7 +-
 .../apache/tomcat/websocket/server/TestClose.java  |  2 +-
 .../tomcat/websocket/server/TestCloseBug58624.java | 13 ++--
 .../tomcat/websocket/server/TestShutdown.java      | 14 ++--
 .../tomcat/websocket/server/TestSlowClient.java    |  3 +-
 .../tomcat/websocket/server/TestUriTemplate.java   | 54 ++++++++--------
 .../server/TestWsRemoteEndpointImplServer.java     | 28 +++-----
 .../websocket/server/TestWsServerContainer.java    | 75 ++++++++--------------
 .../websocket/server/TesterEndpointConfig.java     |  4 +-
 .../tomcat/websocket/server/TesterWsClient.java    | 17 ++---
 11 files changed, 98 insertions(+), 140 deletions(-)

diff --git a/test/org/apache/tomcat/websocket/server/TestAsyncMessages.java 
b/test/org/apache/tomcat/websocket/server/TestAsyncMessages.java
index e9a5893781..ed47f05af3 100644
--- a/test/org/apache/tomcat/websocket/server/TestAsyncMessages.java
+++ b/test/org/apache/tomcat/websocket/server/TestAsyncMessages.java
@@ -54,9 +54,7 @@ public class TestAsyncMessages extends TomcatBaseTest {
 
         WebSocketContainer wsContainer = 
ContainerProvider.getWebSocketContainer();
         ClientEndpointConfig clientEndpointConfig = 
ClientEndpointConfig.Builder.create().build();
-        Session wsSession = wsContainer.connectToServer(
-                TesterProgrammaticEndpoint.class,
-                clientEndpointConfig,
+        Session wsSession = 
wsContainer.connectToServer(TesterProgrammaticEndpoint.class, 
clientEndpointConfig,
                 new URI("ws://localhost:" + getPort() + 
TesterAsyncTiming.Config.PATH));
 
         AsyncTimingClientHandler handler = new AsyncTimingClientHandler();
@@ -80,7 +78,7 @@ public class TestAsyncMessages extends TomcatBaseTest {
         public void onMessage(ByteBuffer message, boolean last) {
             if (lastMessage == 0) {
                 // First message. Don't check
-                sequence ++;
+                sequence++;
                 lastMessage = System.nanoTime();
             } else {
                 long newTime = System.nanoTime();
@@ -88,9 +86,10 @@ public class TestAsyncMessages extends TomcatBaseTest {
                 lastMessage = newTime;
 
                 if (sequence == 0) {
-                    sequence ++;
+                    sequence++;
                     if (message.capacity() != 8192) {
-                        System.out.println("Expected size 8192 but was [" + 
message.capacity() + "], count [" + count + "]");
+                        System.out.println(
+                                "Expected size 8192 but was [" + 
message.capacity() + "], count [" + count + "]");
                         fail = true;
                     }
                     if (diff < 40000000) {
@@ -98,9 +97,10 @@ public class TestAsyncMessages extends TomcatBaseTest {
                         fail = true;
                     }
                 } else if (sequence == 1) {
-                    sequence ++;
+                    sequence++;
                     if (message.capacity() != 8192) {
-                        System.out.println("Expected size 8192 but was [" + 
message.capacity() + "], count [" + count + "]");
+                        System.out.println(
+                                "Expected size 8192 but was [" + 
message.capacity() + "], count [" + count + "]");
                         fail = true;
                     }
                     if (diff > 500000) {
@@ -110,7 +110,8 @@ public class TestAsyncMessages extends TomcatBaseTest {
                 } else if (sequence == 2) {
                     sequence = 0;
                     if (message.capacity() != 4096) {
-                        System.out.println("Expected size 4096 but was [" + 
message.capacity() + "], count [" + count + "]");
+                        System.out.println(
+                                "Expected size 4096 but was [" + 
message.capacity() + "], count [" + count + "]");
                         fail = true;
                     }
                     if (diff > 500000) {
@@ -120,7 +121,7 @@ public class TestAsyncMessages extends TomcatBaseTest {
                 }
             }
 
-            count ++;
+            count++;
             if (count >= TesterAsyncTiming.Config.ITERATIONS * 3) {
                 latch.countDown();
             }
diff --git a/test/org/apache/tomcat/websocket/server/TestClassLoader.java 
b/test/org/apache/tomcat/websocket/server/TestClassLoader.java
index 84afed1db2..ffcbcb32d6 100644
--- a/test/org/apache/tomcat/websocket/server/TestClassLoader.java
+++ b/test/org/apache/tomcat/websocket/server/TestClassLoader.java
@@ -65,8 +65,7 @@ public class TestClassLoader extends WebSocketBaseTest {
 
         Client client = new Client();
 
-        Session wsSession = wsContainer.connectToServer(client,
-                new URI("ws://localhost:" + getPort() + "/test"));
+        Session wsSession = wsContainer.connectToServer(client, new 
URI("ws://localhost:" + getPort() + "/test"));
 
         Assert.assertTrue(wsSession.isOpen());
 
@@ -77,7 +76,7 @@ public class TestClassLoader extends WebSocketBaseTest {
         }
 
         // Check it
-        Assert.assertEquals(1,  client.getMsgCount());
+        Assert.assertEquals(1, client.getMsgCount());
         Assert.assertFalse(client.hasFailed());
 
         wsSession.getBasicRemote().sendText("Testing");
@@ -88,7 +87,7 @@ public class TestClassLoader extends WebSocketBaseTest {
             Thread.sleep(100);
         }
 
-        Assert.assertEquals(2,  client.getMsgCount());
+        Assert.assertEquals(2, client.getMsgCount());
         Assert.assertFalse(client.hasFailed());
 
         wsSession.close();
diff --git a/test/org/apache/tomcat/websocket/server/TestClose.java 
b/test/org/apache/tomcat/websocket/server/TestClose.java
index fde8dea8d1..618a60221d 100644
--- a/test/org/apache/tomcat/websocket/server/TestClose.java
+++ b/test/org/apache/tomcat/websocket/server/TestClose.java
@@ -67,7 +67,7 @@ public class TestClose extends WebSocketBaseTest {
         // Parameter of an @OnError call
         public volatile Throwable onErrorThrowable = null;
 
-        //This is set to true for tests where the @OnMessage should send a 
message
+        // This is set to true for tests where the @OnMessage should send a 
message
         public volatile boolean onMessageSends = false;
     }
 
diff --git a/test/org/apache/tomcat/websocket/server/TestCloseBug58624.java 
b/test/org/apache/tomcat/websocket/server/TestCloseBug58624.java
index 7feb93bc04..5dde76f61e 100644
--- a/test/org/apache/tomcat/websocket/server/TestCloseBug58624.java
+++ b/test/org/apache/tomcat/websocket/server/TestCloseBug58624.java
@@ -67,7 +67,7 @@ public class TestCloseBug58624 extends WebSocketBaseTest {
             count++;
             Thread.sleep(100);
         }
-        Assert.assertNotEquals(0,  
Bug58624ServerEndpoint.getOpenSessionCount());
+        Assert.assertNotEquals(0, 
Bug58624ServerEndpoint.getOpenSessionCount());
 
         // Now close the session
         session.close();
@@ -78,10 +78,10 @@ public class TestCloseBug58624 extends WebSocketBaseTest {
             count++;
             Thread.sleep(100);
         }
-        Assert.assertEquals(0,  Bug58624ServerEndpoint.getOpenSessionCount());
+        Assert.assertEquals(0, Bug58624ServerEndpoint.getOpenSessionCount());
 
         // Ensure no errors were reported on the server
-        Assert.assertEquals(0,  Bug58624ServerEndpoint.getErrorCount());
+        Assert.assertEquals(0, Bug58624ServerEndpoint.getErrorCount());
 
         if (client.getError() != null) {
             throw client.getError();
@@ -114,11 +114,10 @@ public class TestCloseBug58624 extends WebSocketBaseTest {
         public void contextInitialized(ServletContextEvent sce) {
             super.contextInitialized(sce);
 
-            ServerContainer sc = (ServerContainer) 
sce.getServletContext().getAttribute(
-                    Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
+            ServerContainer sc = (ServerContainer) sce.getServletContext()
+                    
.getAttribute(Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
 
-            ServerEndpointConfig sec = ServerEndpointConfig.Builder.create(
-                    Bug58624ServerEndpoint.class, PATH).build();
+            ServerEndpointConfig sec = 
ServerEndpointConfig.Builder.create(Bug58624ServerEndpoint.class, PATH).build();
 
             try {
                 sc.addEndpoint(sec);
diff --git a/test/org/apache/tomcat/websocket/server/TestShutdown.java 
b/test/org/apache/tomcat/websocket/server/TestShutdown.java
index 6a4a8817bf..b901a50043 100644
--- a/test/org/apache/tomcat/websocket/server/TestShutdown.java
+++ b/test/org/apache/tomcat/websocket/server/TestShutdown.java
@@ -42,8 +42,8 @@ import 
org.apache.tomcat.websocket.TesterMessageCountClient.TesterProgrammaticEn
 import org.apache.tomcat.websocket.WebSocketBaseTest;
 
 /**
- * Tests inspired by https://bz.apache.org/bugzilla/show_bug.cgi?id=58835 to
- * check that WebSocket connections are closed gracefully on Tomcat shutdown.
+ * Tests inspired by https://bz.apache.org/bugzilla/show_bug.cgi?id=58835 to 
check that WebSocket connections are closed
+ * gracefully on Tomcat shutdown.
  */
 public class TestShutdown extends WebSocketBaseTest {
 
@@ -60,9 +60,7 @@ public class TestShutdown extends WebSocketBaseTest {
 
         WebSocketContainer wsContainer = 
ContainerProvider.getWebSocketContainer();
         ClientEndpointConfig clientEndpointConfig = 
ClientEndpointConfig.Builder.create().build();
-        Session wsSession = wsContainer.connectToServer(
-                TesterProgrammaticEndpoint.class,
-                clientEndpointConfig,
+        Session wsSession = 
wsContainer.connectToServer(TesterProgrammaticEndpoint.class, 
clientEndpointConfig,
                 new URI("ws://localhost:" + getPort() + "/test"));
         CountDownLatch latch = new CountDownLatch(1);
         BasicText handler = new BasicText(latch);
@@ -74,8 +72,7 @@ public class TestShutdown extends WebSocketBaseTest {
             Thread.sleep(200);
             count++;
         }
-        Assert.assertNotEquals("Message not received by server",
-                EchoBufferedEndpoint.messageCount.get(), 0);
+        Assert.assertNotEquals("Message not received by server", 
EchoBufferedEndpoint.messageCount.get(), 0);
 
         tomcat.stop();
 
@@ -97,8 +94,7 @@ public class TestShutdown extends WebSocketBaseTest {
         private static AtomicLong messageCount = new AtomicLong(0);
 
         @OnOpen
-        public void onOpen(Session session, @SuppressWarnings("unused") 
EndpointConfig  epc)
-                throws IOException {
+        public void onOpen(Session session, @SuppressWarnings("unused") 
EndpointConfig epc) throws IOException {
             session.getAsyncRemote().setBatchingAllowed(true);
         }
 
diff --git a/test/org/apache/tomcat/websocket/server/TestSlowClient.java 
b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
index 8c736088e3..d5d05d81a4 100644
--- a/test/org/apache/tomcat/websocket/server/TestSlowClient.java
+++ b/test/org/apache/tomcat/websocket/server/TestSlowClient.java
@@ -52,7 +52,8 @@ public class TestSlowClient extends WebSocketBaseTest {
         // WebSocket client
         WebSocketContainer wsContainer = 
ContainerProvider.getWebSocketContainer();
         Session wsSession = 
wsContainer.connectToServer(TesterProgrammaticEndpoint.class,
-                ClientEndpointConfig.Builder.create().build(), new 
URI("ws://localhost:" + getPort() + TesterFirehoseServer.PATH));
+                ClientEndpointConfig.Builder.create().build(),
+                new URI("ws://localhost:" + getPort() + 
TesterFirehoseServer.PATH));
         // Configure a handler designed to create a backlog causing the server
         // side write to time out.
         wsSession.addMessageHandler(new VerySlowHandler());
diff --git a/test/org/apache/tomcat/websocket/server/TestUriTemplate.java 
b/test/org/apache/tomcat/websocket/server/TestUriTemplate.java
index 96f8569d95..b2071be3d3 100644
--- a/test/org/apache/tomcat/websocket/server/TestUriTemplate.java
+++ b/test/org/apache/tomcat/websocket/server/TestUriTemplate.java
@@ -26,7 +26,7 @@ public class TestUriTemplate {
     @Test
     public void testBasic() throws Exception {
         UriTemplate t = new UriTemplate("/{a}/{b}");
-        Map<String,String> result = t.match(new UriTemplate("/foo/bar"));
+        Map<String, String> result = t.match(new UriTemplate("/foo/bar"));
 
         Assert.assertEquals(2, result.size());
         Assert.assertTrue(result.containsKey("a"));
@@ -39,40 +39,40 @@ public class TestUriTemplate {
     @Test
     public void testOneOfTwo() throws Exception {
         UriTemplate t = new UriTemplate("/{a}/{b}");
-        Map<String,String> result = t.match(new UriTemplate("/foo"));
+        Map<String, String> result = t.match(new UriTemplate("/foo"));
         Assert.assertNull(result);
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testBasicPrefix() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("/x{a}/y{b}");
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testPrefixOneOfTwo() throws Exception {
         UriTemplate t = new UriTemplate("/x{a}/y{b}");
         t.match(new UriTemplate("/xfoo"));
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testPrefixTwoOfTwo() throws Exception {
         UriTemplate t = new UriTemplate("/x{a}/y{b}");
         t.match(new UriTemplate("/ybar"));
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testQuote1() throws Exception {
         UriTemplate t = new UriTemplate("/.{a}");
         t.match(new UriTemplate("/yfoo"));
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testQuote2() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("/.{a}");
@@ -82,7 +82,7 @@ public class TestUriTemplate {
     @Test
     public void testNoParams() throws Exception {
         UriTemplate t = new UriTemplate("/foo/bar");
-        Map<String,String> result = t.match(new UriTemplate("/foo/bar"));
+        Map<String, String> result = t.match(new UriTemplate("/foo/bar"));
 
         Assert.assertEquals(0, result.size());
     }
@@ -91,7 +91,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample1_01() throws Exception {
         UriTemplate t = new UriTemplate("/a/b");
-        Map<String,String> result = t.match(new UriTemplate("/a/b"));
+        Map<String, String> result = t.match(new UriTemplate("/a/b"));
 
         Assert.assertEquals(0, result.size());
     }
@@ -100,7 +100,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample1_02() throws Exception {
         UriTemplate t = new UriTemplate("/a/b");
-        Map<String,String> result = t.match(new UriTemplate("/a"));
+        Map<String, String> result = t.match(new UriTemplate("/a"));
 
         Assert.assertNull(result);
     }
@@ -109,7 +109,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample1_03() throws Exception {
         UriTemplate t = new UriTemplate("/a/b");
-        Map<String,String> result = t.match(new UriTemplate("/a/bb"));
+        Map<String, String> result = t.match(new UriTemplate("/a/bb"));
 
         Assert.assertNull(result);
     }
@@ -118,7 +118,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample2_01() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a/b"));
+        Map<String, String> result = t.match(new UriTemplate("/a/b"));
 
         Assert.assertEquals(1, result.size());
         Assert.assertEquals("b", result.get("var"));
@@ -128,7 +128,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample2_02() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a/apple"));
+        Map<String, String> result = t.match(new UriTemplate("/a/apple"));
 
         Assert.assertEquals(1, result.size());
         Assert.assertEquals("apple", result.get("var"));
@@ -138,7 +138,7 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample2_03() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a"));
+        Map<String, String> result = t.match(new UriTemplate("/a"));
 
         Assert.assertNull(result);
     }
@@ -147,13 +147,13 @@ public class TestUriTemplate {
     @Test
     public void testSpecExample2_04() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a/b/c"));
+        Map<String, String> result = t.match(new UriTemplate("/a/b/c"));
 
         Assert.assertNull(result);
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testDuplicate01() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("/{var}/{var}");
@@ -163,7 +163,7 @@ public class TestUriTemplate {
     @Test
     public void testDuplicate02() throws Exception {
         UriTemplate t = new UriTemplate("/{a}/{b}");
-        Map<String,String> result = t.match(new UriTemplate("/x/x"));
+        Map<String, String> result = t.match(new UriTemplate("/x/x"));
 
         Assert.assertEquals(2, result.size());
         Assert.assertEquals("x", result.get("a"));
@@ -173,7 +173,7 @@ public class TestUriTemplate {
 
     public void testEgMailingList01() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a/b/"));
+        Map<String, String> result = t.match(new UriTemplate("/a/b/"));
 
         Assert.assertNull(result);
     }
@@ -181,7 +181,7 @@ public class TestUriTemplate {
 
     public void testEgMailingList02() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a/"));
+        Map<String, String> result = t.match(new UriTemplate("/a/"));
 
         Assert.assertNull(result);
     }
@@ -190,43 +190,43 @@ public class TestUriTemplate {
     @Test
     public void testEgMailingList03() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}");
-        Map<String,String> result = t.match(new UriTemplate("/a"));
+        Map<String, String> result = t.match(new UriTemplate("/a"));
 
         Assert.assertNull(result);
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testEgMailingList04() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var1}/{var2}");
         @SuppressWarnings("unused")
-        Map<String,String> result = t.match(new UriTemplate("/a//c"));
+        Map<String, String> result = t.match(new UriTemplate("/a//c"));
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testEgMailingList05() throws Exception {
         UriTemplate t = new UriTemplate("/a/{var}/");
         @SuppressWarnings("unused")
-        Map<String,String> result = t.match(new UriTemplate("/a/b/"));
+        Map<String, String> result = t.match(new UriTemplate("/a/b/"));
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testSpecIssue194a() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("/a/../b");
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testSpecIssue194b() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("/./b");
     }
 
 
-    @Test(expected=jakarta.websocket.DeploymentException.class)
+    @Test(expected = jakarta.websocket.DeploymentException.class)
     public void testSpecIssue194c() throws Exception {
         @SuppressWarnings("unused")
         UriTemplate t = new UriTemplate("//b");
diff --git 
a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServer.java 
b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServer.java
index cbc0bd3da6..4a6271fe7e 100644
--- 
a/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServer.java
+++ 
b/test/org/apache/tomcat/websocket/server/TestWsRemoteEndpointImplServer.java
@@ -51,20 +51,15 @@ public class TestWsRemoteEndpointImplServer extends 
WebSocketBaseTest {
     /*
      * https://bz.apache.org/bugzilla/show_bug.cgi?id=58624
      *
-     * This test requires three breakpoints to be set. Two in this file (marked
-     * A & B with comments) and one (C) at the start of
-     * WsRemoteEndpointImplServer.doWrite().
+     * This test requires three breakpoints to be set. Two in this file 
(marked A & B with comments) and one (C) at the
+     * start of WsRemoteEndpointImplServer.doWrite().
      *
-     * With the breakpoints in place, run this test.
-     * Once breakpoints A & B are reached, progress the thread at breakpoint A
-     * one line to close the connection.
-     * Once breakpoint C is reached, allow the thread at breakpoint B to
-     * continue.
-     * Then allow the thread at breakpoint C to continue.
+     * With the breakpoints in place, run this test. Once breakpoints A & B 
are reached, progress the thread at
+     * breakpoint A one line to close the connection. Once breakpoint C is 
reached, allow the thread at breakpoint B to
+     * continue. Then allow the thread at breakpoint C to continue.
      *
-     * In the failure mode, the thread at breakpoint B will not progress past
-     * the call to sendObject(). If the issue is fixed, the thread at 
breakpoint
-     * B will continue past sendObject() and terminate with a TimeoutException.
+     * In the failure mode, the thread at breakpoint B will not progress past 
the call to sendObject(). If the issue is
+     * fixed, the thread at breakpoint B will continue past sendObject() and 
terminate with a TimeoutException.
      */
     @Test
     public void testClientDropsConnection() throws Exception {
@@ -75,8 +70,7 @@ public class TestWsRemoteEndpointImplServer extends 
WebSocketBaseTest {
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMappingDecoded("/", "default");
 
-        WebSocketContainer wsContainer =
-                ContainerProvider.getWebSocketContainer();
+        WebSocketContainer wsContainer = 
ContainerProvider.getWebSocketContainer();
 
         tomcat.start();
 
@@ -97,8 +91,7 @@ public class TestWsRemoteEndpointImplServer extends 
WebSocketBaseTest {
         protected ServerEndpointConfig getServerEndpointConfig() {
             List<Class<? extends Encoder>> encoders = new ArrayList<>();
             encoders.add(Bug58624Encoder.class);
-            return ServerEndpointConfig.Builder.create(
-                    Bug58624Endpoint.class, PATH).encoders(encoders).build();
+            return ServerEndpointConfig.Builder.create(Bug58624Endpoint.class, 
PATH).encoders(encoders).build();
         }
     }
 
@@ -109,8 +102,7 @@ public class TestWsRemoteEndpointImplServer extends 
WebSocketBaseTest {
         @OnOpen
         public void onOpen(Session session) {
             // Disabling blocking timeouts for this test
-            session.getUserProperties().put(
-                    
org.apache.tomcat.websocket.Constants.BLOCKING_SEND_TIMEOUT_PROPERTY,
+            
session.getUserProperties().put(org.apache.tomcat.websocket.Constants.BLOCKING_SEND_TIMEOUT_PROPERTY,
                     Long.valueOf(-1));
             ex.submit(new Bug58624SendMessage(session));
         }
diff --git a/test/org/apache/tomcat/websocket/server/TestWsServerContainer.java 
b/test/org/apache/tomcat/websocket/server/TestWsServerContainer.java
index 28fc72b1fd..db18f0c06e 100644
--- a/test/org/apache/tomcat/websocket/server/TestWsServerContainer.java
+++ b/test/org/apache/tomcat/websocket/server/TestWsServerContainer.java
@@ -68,8 +68,7 @@ public class TestWsServerContainer extends WebSocketBaseTest {
         Tomcat.addServlet(ctx, "default", new DefaultServlet());
         ctx.addServletMappingDecoded("/", "default");
 
-        WebSocketContainer wsContainer =
-                ContainerProvider.getWebSocketContainer();
+        WebSocketContainer wsContainer = 
ContainerProvider.getWebSocketContainer();
 
         tomcat.start();
 
@@ -100,8 +99,7 @@ public class TestWsServerContainer extends WebSocketBaseTest 
{
 
         @Override
         protected ServerEndpointConfig getServerEndpointConfig() {
-            return ServerEndpointConfig.Builder.create(
-                    TesterEchoServer.Basic.class, "/{param}").build();
+            return 
ServerEndpointConfig.Builder.create(TesterEchoServer.Basic.class, 
"/{param}").build();
         }
     }
 
@@ -110,12 +108,9 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testSpecExample3() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/{var}/c").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/c").build();
-        ServerEndpointConfig configC = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/{var1}/{var2}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/a/{var}/c").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
+        ServerEndpointConfig configC = 
ServerEndpointConfig.Builder.create(Object.class, "/a/{var1}/{var2}").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -131,10 +126,8 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testSpecExample4() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/{var1}/d").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/b/{var2}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/{var1}/d").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/b/{var2}").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -147,10 +140,8 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths01() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/c").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/c").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/c").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -161,10 +152,8 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths02() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/{var}").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/{var}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var}").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -175,10 +164,8 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths03() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/{var1}").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/{var2}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var1}").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var2}").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -189,10 +176,8 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths04() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/{var1}/{var2}").build();
-        ServerEndpointConfig configB = ServerEndpointConfig.Builder.create(
-                Object.class, "/a/b/{var2}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/a/{var1}/{var2}").build();
+        ServerEndpointConfig configB = 
ServerEndpointConfig.Builder.create(Object.class, "/a/b/{var2}").build();
 
         sc.addEndpoint(configA);
         sc.addEndpoint(configB);
@@ -203,15 +188,13 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
 
 
     /*
-     * Simulates a class that gets picked up for extending Endpoint and for
-     * being annotated.
+     * Simulates a class that gets picked up for extending Endpoint and for 
being annotated.
      */
     @Test(expected = DeploymentException.class)
     public void testDuplicatePaths11() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Pojo.class, "/foo").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Pojo.class, "/foo").build();
 
         sc.addEndpoint(configA, false);
         sc.addEndpoint(Pojo.class, true);
@@ -225,8 +208,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths12() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Pojo.class, "/foo").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Pojo.class, "/foo").build();
 
         sc.addEndpoint(Pojo.class, true);
         sc.addEndpoint(configA);
@@ -242,8 +224,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths13() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Pojo.class, "/foo").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Pojo.class, "/foo").build();
 
         sc.addEndpoint(Pojo.class);
         sc.addEndpoint(configA);
@@ -257,8 +238,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths14() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/foo").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/foo").build();
 
         sc.addEndpoint(Pojo.class, true);
         sc.addEndpoint(configA);
@@ -266,15 +246,13 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
 
 
     /*
-     * Simulates a class that gets picked up for extending Endpoint and for
-     * being annotated.
+     * Simulates a class that gets picked up for extending Endpoint and for 
being annotated.
      */
     @Test(expected = DeploymentException.class)
     public void testDuplicatePaths21() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                PojoTemplate.class, "/foo/{a}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(PojoTemplate.class, "/foo/{a}").build();
 
         sc.addEndpoint(configA, false);
         sc.addEndpoint(PojoTemplate.class, true);
@@ -288,8 +266,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths22() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                PojoTemplate.class, "/foo/{a}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(PojoTemplate.class, "/foo/{a}").build();
 
         sc.addEndpoint(PojoTemplate.class, true);
         sc.addEndpoint(configA);
@@ -305,8 +282,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths23() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                PojoTemplate.class, "/foo/{a}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(PojoTemplate.class, "/foo/{a}").build();
 
         sc.addEndpoint(PojoTemplate.class);
         sc.addEndpoint(configA);
@@ -320,8 +296,7 @@ public class TestWsServerContainer extends 
WebSocketBaseTest {
     public void testDuplicatePaths24() throws Exception {
         WsServerContainer sc = new WsServerContainer(new 
TesterServletContext());
 
-        ServerEndpointConfig configA = ServerEndpointConfig.Builder.create(
-                Object.class, "/foo/{a}").build();
+        ServerEndpointConfig configA = 
ServerEndpointConfig.Builder.create(Object.class, "/foo/{a}").build();
 
         sc.addEndpoint(PojoTemplate.class, true);
         sc.addEndpoint(configA);
diff --git a/test/org/apache/tomcat/websocket/server/TesterEndpointConfig.java 
b/test/org/apache/tomcat/websocket/server/TesterEndpointConfig.java
index 934660631a..ad4e0d4af1 100644
--- a/test/org/apache/tomcat/websocket/server/TesterEndpointConfig.java
+++ b/test/org/apache/tomcat/websocket/server/TesterEndpointConfig.java
@@ -27,8 +27,8 @@ public abstract class TesterEndpointConfig extends 
WsContextListener {
     public void contextInitialized(ServletContextEvent sce) {
         super.contextInitialized(sce);
 
-        ServerContainer sc = (ServerContainer) 
sce.getServletContext().getAttribute(
-                Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
+        ServerContainer sc = (ServerContainer) sce.getServletContext()
+                
.getAttribute(Constants.SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE);
 
         try {
             ServerEndpointConfig sec = getServerEndpointConfig();
diff --git a/test/org/apache/tomcat/websocket/server/TesterWsClient.java 
b/test/org/apache/tomcat/websocket/server/TesterWsClient.java
index e1b79623ba..e78163ac49 100644
--- a/test/org/apache/tomcat/websocket/server/TesterWsClient.java
+++ b/test/org/apache/tomcat/websocket/server/TesterWsClient.java
@@ -25,13 +25,11 @@ import java.nio.charset.StandardCharsets;
 import jakarta.websocket.CloseReason.CloseCode;
 
 /**
- * A client for testing Websocket behavior that differs from standard client
- * behavior.
+ * A client for testing Websocket behavior that differs from standard client 
behavior.
  */
 public class TesterWsClient {
 
-    private static final byte[] maskingKey = new byte[] { 0x12, 0x34, 0x56,
-            0x78 };
+    private static final byte[] maskingKey = new byte[] { 0x12, 0x34, 0x56, 
0x78 };
 
     private final Socket socket;
 
@@ -68,8 +66,7 @@ public class TesterWsClient {
     }
 
     private void readUpgradeResponse() throws IOException {
-        BufferedReader in = new BufferedReader(new InputStreamReader(
-                socket.getInputStream()));
+        BufferedReader in = new BufferedReader(new 
InputStreamReader(socket.getInputStream()));
         String line = in.readLine();
         while (line != null && !line.isEmpty()) {
             line = in.readLine();
@@ -98,11 +95,9 @@ public class TesterWsClient {
     }
 
     private static String createUpgradeRequest(String path) {
-        String[] upgradeRequestLines = { "GET " + path + " HTTP/1.1",
-                "Connection: Upgrade", "Host: localhost:8080",
-                "Origin: localhost:8080",
-                "Sec-WebSocket-Key: OEvAoAKn5jsuqv2/YJ1Wfg==",
-                "Sec-WebSocket-Version: 13", "Upgrade: websocket" };
+        String[] upgradeRequestLines = { "GET " + path + " HTTP/1.1", 
"Connection: Upgrade", "Host: localhost:8080",
+                "Origin: localhost:8080", "Sec-WebSocket-Key: 
OEvAoAKn5jsuqv2/YJ1Wfg==", "Sec-WebSocket-Version: 13",
+                "Upgrade: websocket" };
         StringBuffer sb = new StringBuffer();
         for (String line : upgradeRequestLines) {
             sb.append(line);


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


Reply via email to