diff --git a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java index 9aa3634c89f..5f67ffb7331 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java +++ b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/client/WriteTimeoutTest.java @@ -107,18 +107,18 @@ public class WriteTimeoutTest @ServerEndpoint("/logSocket") public static class LoggingSocket { - private final Logger LOG = Log.getLogger(LoggingSocket.class); + private final Logger log = Log.getLogger(LoggingSocket.class); @OnMessage public void onMessage(String msg) { - LOG.debug("onMessage(): {}", msg); + log.debug("onMessage(): {}", msg); } @OnError public void onError(Throwable t) { - LOG.debug("onError(): {}", t); + log.debug("onError(): {}", t); } } } diff --git a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/coders/TimeEncoder.java b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/coders/TimeEncoder.java index e482566b249..f4f9c2a4e4c 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/coders/TimeEncoder.java +++ b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/coders/TimeEncoder.java @@ -30,7 +30,7 @@ import javax.websocket.EndpointConfig; */ public class TimeEncoder implements Encoder.Text { - private TimeZone GMT = TimeZone.getTimeZone("GMT"); + private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); @Override public String encode(Date object) throws EncodeException diff --git a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PrimitivesTextEchoTest.java b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PrimitivesTextEchoTest.java index a01395e264b..6f8fdbe7919 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PrimitivesTextEchoTest.java +++ b/jetty-websocket/javax-websocket-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/PrimitivesTextEchoTest.java @@ -324,14 +324,14 @@ public class PrimitivesTextEchoTest addCase(data, LongEchoSocket.class, Long.toString(0), "0"); addCase(data, LongEchoSocket.class, Long.toString(100_000), "100000"); addCase(data, LongEchoSocket.class, Long.toString(-2_000_000), "-2000000"); - addCase(data, LongEchoSocket.class, Long.toString(300_000_000_000l), "300000000000"); + addCase(data, LongEchoSocket.class, Long.toString(300_000_000_000L), "300000000000"); addCase(data, LongEchoSocket.class, Long.toString(Long.MAX_VALUE), Long.toString(Long.MAX_VALUE)); addCase(data, LongEchoSocket.class, Long.toString(Long.MIN_VALUE), Long.toString(Long.MIN_VALUE)); addCase(data, LongObjEchoSocket.class, Long.toString(0), "0"); addCase(data, LongObjEchoSocket.class, Long.toString(100_000), "100000"); addCase(data, LongObjEchoSocket.class, Long.toString(-2_000_000), "-2000000"); - addCase(data, LongObjEchoSocket.class, Long.toString(300_000_000_000l), "300000000000"); + addCase(data, LongObjEchoSocket.class, Long.toString(300_000_000_000L), "300000000000"); addCase(data, LongObjEchoSocket.class, Long.toString(Long.MAX_VALUE), Long.toString(Long.MAX_VALUE)); addCase(data, LongObjEchoSocket.class, Long.toString(Long.MIN_VALUE), Long.toString(Long.MIN_VALUE)); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java index f1eac07f18f..f267a0e8549 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserTest.java @@ -98,7 +98,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.2 */ @Test - public void testParse_Binary_125BytePayload() throws InterruptedException + public void testParseBinary125BytePayload() throws InterruptedException { int length = 125; @@ -128,7 +128,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.3 */ @Test - public void testParse_Binary_126BytePayload() throws InterruptedException + public void testParseBinary126BytePayload() throws InterruptedException { int length = 126; @@ -161,7 +161,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.4 */ @Test - public void testParse_Binary_127BytePayload() throws InterruptedException + public void testParseBinary127BytePayload() throws InterruptedException { int length = 127; @@ -193,7 +193,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.5 */ @Test - public void testParse_Binary_128BytePayload() throws InterruptedException + public void testParseBinary128BytePayload() throws InterruptedException { int length = 128; @@ -225,7 +225,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.6 */ @Test - public void testParse_Binary_65535BytePayload() throws InterruptedException + public void testParseBinary65535BytePayload() throws InterruptedException { int length = 65535; @@ -257,7 +257,7 @@ public class ParserTest * From Autobahn WebSocket Server Testcase 1.2.7 */ @Test - public void testParse_Binary_65536BytePayload() throws InterruptedException + public void testParseBinary65536BytePayload() throws InterruptedException { int length = 65536; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java index f498d314a3b..5030174ff75 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/RawFrameBuilder.java @@ -39,7 +39,7 @@ public class RawFrameBuilder buf.put(b); } - public static void putLengthAndMask(ByteBuffer buf, int length, byte mask[]) + public static void putLengthAndMask(ByteBuffer buf, int length, byte[] mask) { if (mask != null) { @@ -53,7 +53,7 @@ public class RawFrameBuilder } } - public static void mask(final byte[] data, final byte mask[]) + public static void mask(final byte[] data, final byte[] mask) { assertThat("Mask.length", mask.length, is(4)); int len = data.length; @@ -96,7 +96,7 @@ public class RawFrameBuilder } } - public static void putMask(ByteBuffer buf, byte mask[]) + public static void putMask(ByteBuffer buf, byte[] mask) { assertThat("Mask.length", mask.length, is(4)); buf.put(mask); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java index faac67ec21b..b63186e27cd 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestAsyncFrameHandler.java @@ -76,7 +76,7 @@ public class TestAsyncFrameHandler implements FrameHandler @Override public void onError(Throwable cause, Callback callback) { - LOG.info("[{}] onError {} ", name, cause == null?null:cause.toString()); + LOG.info("[{}] onError {} ", name, cause == null ? null : cause.toString()); error = cause; errorLatch.countDown(); callback.succeeded(); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java index 448eef59a30..99b95f3dd9b 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestMessageHandler.java @@ -29,7 +29,7 @@ import org.eclipse.jetty.util.log.Logger; public class TestMessageHandler extends MessageHandler { - protected final Logger LOG = Log.getLogger(TestMessageHandler.class); + protected static final Logger LOG = Log.getLogger(TestMessageHandler.class); public CoreSession coreSession; public BlockingQueue textMessages = new BlockingArrayQueue<>(); diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java index e9e0e499368..71a4d35ea42 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/PerMessageDeflateExtensionTest.java @@ -79,7 +79,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block */ @Test - public void testDraft21_Hello_UnCompressedBlock() + public void testDraft21HelloUnCompressedBlock() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -100,7 +100,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.1: A message compressed using 1 compressed DEFLATE block (with fragmentation) */ @Test - public void testDraft21_Hello_UnCompressedBlock_Fragmented() + public void testDraft21HelloUnCompressedBlockFragmented() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -123,7 +123,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.2: Sharing LZ77 Sliding Window */ @Test - public void testDraft21_SharingL77SlidingWindow_ContextTakeover() + public void testDraft21SharingL77SlidingWindowContextTakeover() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -146,7 +146,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.2: Sharing LZ77 Sliding Window */ @Test - public void testDraft21_SharingL77SlidingWindow_NoContextTakeover() + public void testDraft21SharingL77SlidingWindowNoContextTakeover() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -170,7 +170,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.3: Using a DEFLATE Block with No Compression */ @Test - public void testDraft21_DeflateBlockWithNoCompression() + public void testDraft21DeflateBlockWithNoCompression() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -189,7 +189,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.4: Using a DEFLATE Block with BFINAL Set to 1 */ @Test - public void testDraft21_DeflateBlockWithBFinal1() + public void testDraft21DeflateBlockWithBFinal1() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -209,7 +209,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Section 8.2.3.5: Two DEFLATE Blocks in 1 Message */ @Test - public void testDraft21_TwoDeflateBlocksOneMessage() + public void testDraft21TwoDeflateBlocksOneMessage() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -227,7 +227,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest * Decode fragmented message (3 parts: TEXT, CONTINUATION, CONTINUATION) */ @Test - public void testParseFragmentedMessage_Good() + public void testParseFragmentedMessageGood() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -256,7 +256,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest *

*/ @Test - public void testParseFragmentedMessage_BadRsv1() + public void testParseFragmentedMessageBadRsv1() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate"); @@ -489,7 +489,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Client_NoContextTakeover_ThreeOra() + public void testPyWebSocketClientNoContextTakeoverThreeOra() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover"); @@ -497,7 +497,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest // Captured from Pywebsocket (r790) - 3 messages with similar parts. - tester.parseIncomingHex( // context takeover (3 messages) + tester.parseIncomingHex(// context takeover (3 messages) "c1 09 0a c9 2f 4a 0c 01 62 00 00", // ToraTora "c1 0b 72 2c c9 2f 4a 74 cb 01 12 00 00", // AtoraFlora "c1 0b 0a c8 c8 c9 2f 4a 0c 01 62 00 00" // PhloraTora @@ -507,7 +507,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Client_ToraToraTora() + public void testPyWebSocketClientToraToraTora() { ExtensionTool.Tester tester = clientExtensions.newTester("permessage-deflate; client_max_window_bits"); @@ -525,7 +525,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Server_NoContextTakeover_ThreeOra() + public void testPyWebSocketServerNoContextTakeoverThreeOra() { ExtensionTool.Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits; client_no_context_takeover"); @@ -533,7 +533,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest // Captured from Pywebsocket (r790) - 3 messages with similar parts. - tester.parseIncomingHex( // context takeover (3 messages) + tester.parseIncomingHex(// context takeover (3 messages) "c1 89 88 bc 1b b1 82 75 34 fb 84 bd 79 b1 88", // ToraTora "c1 8b 50 86 88 b2 22 aa 41 9d 1a f2 43 b3 42 86 88", // AtoraFlora "c1 8b e2 3e 05 53 e8 f6 cd 9a cd 74 09 52 80 3e 05" // PhloraTora @@ -543,7 +543,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest } @Test - public void testPyWebSocket_Server_ToraToraTora() + public void testPyWebSocketServerToraToraTora() { ExtensionTool.Tester tester = serverExtensions.newTester("permessage-deflate; client_max_window_bits"); @@ -551,7 +551,7 @@ public class PerMessageDeflateExtensionTest extends AbstractExtensionTest // Captured from Pywebsocket (r790) - "tora" sent 3 times. - tester.parseIncomingHex( // context takeover (3 messages) + tester.parseIncomingHex(// context takeover (3 messages) "c1 86 69 39 fe 91 43 f0 d1 db 6d 39", // tora 1 "c1 85 2d f3 eb 96 07 f2 89 96 2d", // tora 2 "c1 84 53 ad a5 34 51 cc a5 34" // tora 3 diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java index 1d011d3daa2..24dd71c2f30 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxy.java @@ -188,7 +188,7 @@ class WebSocketProxy // the callback is saved until a close response comes in sendFrame from Server2Proxy // if the callback was completed here then core would send its own close response closeCallback = callback; - sendCallback = Callback.from(()->{}, callback::failed); + sendCallback = Callback.from(() -> {}, callback::failed); } break; @@ -383,7 +383,7 @@ class WebSocketProxy try { state = State.CONNECTING; - client.connect(this, serverUri).whenComplete((s,t)-> + client.connect(this, serverUri).whenComplete((s,t) -> { if (t != null) onConnectFailure(t, callback); @@ -526,7 +526,7 @@ class WebSocketProxy { state = State.ISHUT; closeCallback = callback; - sendCallback = Callback.from(()->{}, callback::failed); + sendCallback = Callback.from(() -> {}, callback::failed); } break; @@ -686,4 +686,4 @@ class WebSocketProxy return "Server2Proxy:" + getState(); } } -} \ No newline at end of file +} diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java index 56111ae6c25..d442d24a0ee 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/proxy/WebSocketProxyTest.java @@ -221,7 +221,6 @@ public class WebSocketProxyTest assertThat(closeStatus.getReason(), containsString("Failed to upgrade to websocket: Unexpected HTTP Response Status Code:")); } - @Test public void testClientError() throws Exception { @@ -241,7 +240,7 @@ public class WebSocketProxyTest ClientUpgradeRequest upgradeRequest = ClientUpgradeRequest.from(_client, new URI("ws://localhost:8080/proxy/"), clientFrameHandler); upgradeRequest.setConfiguration(defaultCustomizer); CompletableFuture response = _client.connect(upgradeRequest); - Exception e = assertThrows(ExecutionException.class, ()->response.get(5, TimeUnit.SECONDS)); + Exception e = assertThrows(ExecutionException.class, () -> response.get(5, TimeUnit.SECONDS)); assertThat(e.getMessage(), containsString("simulated client onOpen error")); assertTrue(clientFrameHandler.closeLatch.await(5, TimeUnit.SECONDS)); assertTrue(serverFrameHandler.closeLatch.await(5, TimeUnit.SECONDS));