diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java index ca726dcd182..423fc860765 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/AbstractJavaxWebSocketFrameHandlerTest.java @@ -51,7 +51,7 @@ public abstract class AbstractJavaxWebSocketFrameHandlerTest protected AvailableDecoders decoders; protected Map uriParams; protected EndpointConfig endpointConfig; - protected FrameHandler.CoreSession session = new FrameHandler.CoreSession.Empty(); + protected FrameHandler.CoreSession coreSession = new FrameHandler.CoreSession.Empty(); public AbstractJavaxWebSocketFrameHandlerTest() { diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnCloseTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnCloseTest.java index 69da2d79668..fe81663331a 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnCloseTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnCloseTest.java @@ -45,7 +45,7 @@ public class JavaxWebSocketFrameHandler_OnCloseTest extends AbstractJavaxWebSock JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // These invocations are the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); CloseStatus status = new CloseStatus(CloseStatus.NORMAL, "Normal"); Frame closeFrame = status.toFrame(); localEndpoint.onFrame(closeFrame, Callback.from(() -> diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnErrorTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnErrorTest.java index 2e3d0182a97..955e3bf8d82 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnErrorTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnErrorTest.java @@ -42,7 +42,7 @@ public class JavaxWebSocketFrameHandler_OnErrorTest extends AbstractJavaxWebSock JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // These invocations are the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); localEndpoint.onError(new RuntimeException("From Testcase"), Callback.NOOP); String event = socket.events.poll(1, TimeUnit.SECONDS); assertThat("Event", event, eventMatcher); diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryStreamTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryStreamTest.java index 3fbf88f7e43..0fcc29c79b1 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryStreamTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryStreamTest.java @@ -45,7 +45,7 @@ public class JavaxWebSocketFrameHandler_OnMessage_BinaryStreamTest extends Abstr JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // This invocation is the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); func.apply(localEndpoint); diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryTest.java index d4096adbb91..da1efac7e52 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_BinaryTest.java @@ -48,7 +48,7 @@ public class JavaxWebSocketFrameHandler_OnMessage_BinaryTest extends AbstractJav JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // This invocation is the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); assertThat("Has Binary Metadata", localEndpoint.getBinaryMetadata(), notNullValue()); diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java index 505308a1949..e0fe14d4e7e 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextStreamTest.java @@ -44,7 +44,7 @@ public class JavaxWebSocketFrameHandler_OnMessage_TextStreamTest extends Abstrac JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // This invocation is the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); func.apply(localEndpoint); diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextTest.java index 776fd44ddb9..ff7cb1e63f6 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnMessage_TextTest.java @@ -47,7 +47,7 @@ public class JavaxWebSocketFrameHandler_OnMessage_TextTest extends AbstractJavax JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // This invocation is the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); ByteBuffer payload = BufferUtil.toBuffer(msg, StandardCharsets.UTF_8); localEndpoint.onFrame(new Frame(OpCode.TEXT).setPayload(payload).setFin(true), Callback.NOOP); diff --git a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnOpenTest.java b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnOpenTest.java index 0e696fd4461..66c0507fbc0 100644 --- a/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnOpenTest.java +++ b/jetty-websocket/javax-websocket-common/src/test/java/org/eclipse/jetty/websocket/javax/common/JavaxWebSocketFrameHandler_OnOpenTest.java @@ -40,7 +40,7 @@ public class JavaxWebSocketFrameHandler_OnOpenTest extends AbstractJavaxWebSocke JavaxWebSocketFrameHandler localEndpoint = newJavaxFrameHandler(socket); // This invocation is the same for all tests - localEndpoint.onOpen(session, Callback.NOOP); + localEndpoint.onOpen(coreSession, Callback.NOOP); String event = socket.events.poll(1, TimeUnit.SECONDS); assertThat("Event", event, eventMatcher); } diff --git a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java index fe1fc5650df..58322af05b4 100644 --- a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java +++ b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/CoreServer.java @@ -18,6 +18,11 @@ package org.eclipse.jetty.websocket.javax.tests; +import java.io.IOException; +import java.net.URI; +import java.util.List; +import java.util.function.Function; + import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; import org.eclipse.jetty.server.Server; @@ -35,11 +40,6 @@ import org.eclipse.jetty.websocket.core.server.WebSocketUpgradeHandler; import org.eclipse.jetty.websocket.javax.tests.framehandlers.FrameEcho; import org.eclipse.jetty.websocket.javax.tests.framehandlers.WholeMessageEcho; -import java.io.IOException; -import java.net.URI; -import java.util.List; -import java.util.function.Function; - public class CoreServer extends ContainerLifeCycle { private Server server; @@ -121,7 +121,7 @@ public class CoreServer extends ContainerLifeCycle } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { } @@ -178,7 +178,7 @@ public class CoreServer extends ContainerLifeCycle } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { } } diff --git a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java index 04495ed5b3c..b816be3edf5 100644 --- a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java +++ b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/NetworkFuzzer.java @@ -156,7 +156,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab { try (SharedBlockingCallback.Blocker blocker = sharedBlockingCallback.acquire()) { - frameCapture.session.sendFrame(f, blocker, false); + frameCapture.coreSession.sendFrame(f, blocker, false); } } } @@ -168,7 +168,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab { try (SharedBlockingCallback.Blocker blocker = sharedBlockingCallback.acquire()) { - frameCapture.session.sendFrame(f, blocker, false); + frameCapture.coreSession.sendFrame(f, blocker, false); } } } @@ -222,7 +222,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab private final BlockingQueue receivedFrames = new LinkedBlockingQueue<>(); private final EndPoint endPoint; private final SharedBlockingCallback blockingCallback = new SharedBlockingCallback(); - private CoreSession session; + private CoreSession coreSession; public FrameCapture(EndPoint endPoint) { @@ -233,7 +233,7 @@ public class NetworkFuzzer extends Fuzzer.Adapter implements Fuzzer, AutoCloseab @Override public void onOpen(CoreSession coreSession, Callback callback) { - this.session = coreSession; + this.coreSession = coreSession; callback.succeeded(); } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java index 18bc2a1661c..9e5c0ff9b4d 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/AbstractExtension.java @@ -34,7 +34,7 @@ public abstract class AbstractExtension implements Extension private ExtensionConfig config; private OutgoingFrames nextOutgoing; private IncomingFrames nextIncoming; - private WebSocketCoreSession session; + private WebSocketCoreSession coreSession; public AbstractExtension() { @@ -141,14 +141,14 @@ public abstract class AbstractExtension implements Extension } @Override - public void setWebSocketCoreSession(WebSocketCoreSession webSocketCoreSession) + public void setWebSocketCoreSession(WebSocketCoreSession coreSession) { - session = webSocketCoreSession; + this.coreSession = coreSession; } protected WebSocketCoreSession getWebSocketCoreSession() { - return session; + return coreSession; } @Override diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java index 12aad46f1a7..8ee9987577c 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/Extension.java @@ -91,7 +91,7 @@ public interface Extension extends IncomingFrames, OutgoingFrames /** * Set the {@link WebSocketCoreSession} for this Extension * - * @param webSocketCoreSession + * @param coreSession */ - void setWebSocketCoreSession(WebSocketCoreSession webSocketCoreSession); + void setWebSocketCoreSession(WebSocketCoreSession coreSession); } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java index c77bf0d2b11..2886e289221 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/FrameHandler.java @@ -516,7 +516,7 @@ public interface FrameHandler extends IncomingFrames interface Customizer { - void customize(CoreSession session); + void customize(CoreSession coreSession); } class ConfigurationCustomizer implements Customizer, Configuration @@ -627,24 +627,24 @@ public interface FrameHandler extends IncomingFrames } @Override - public void customize(CoreSession session) + public void customize(CoreSession coreSession) { if (idleTimeout !=null) - session.setIdleTimeout(idleTimeout); + coreSession.setIdleTimeout(idleTimeout); if (writeTimeout!=null) - session.setWriteTimeout(idleTimeout); + coreSession.setWriteTimeout(idleTimeout); if (autoFragment!=null) - session.setAutoFragment(autoFragment); + coreSession.setAutoFragment(autoFragment); if (maxFrameSize!=null) - session.setMaxFrameSize(maxFrameSize); + coreSession.setMaxFrameSize(maxFrameSize); if (inputBufferSize!=null) - session.setInputBufferSize(inputBufferSize); + coreSession.setInputBufferSize(inputBufferSize); if (outputBufferSize!=null) - session.setOutputBufferSize(outputBufferSize); + coreSession.setOutputBufferSize(outputBufferSize); if (maxBinaryMessageSize!=null) - session.setMaxBinaryMessageSize(maxBinaryMessageSize); + coreSession.setMaxBinaryMessageSize(maxBinaryMessageSize); if (maxTextMessageSize!=null) - session.setMaxTextMessageSize(maxTextMessageSize); + coreSession.setMaxTextMessageSize(maxTextMessageSize); } } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java index 0b854b4c7da..a946eb687e8 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/ClientUpgradeRequest.java @@ -347,15 +347,15 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon extensionStack, WebSocketConstants.SPEC_VERSION_STRING); - WebSocketCoreSession wsSession = newWebSocketCoreSession(frameHandler, negotiated); - wsClient.customize(wsSession); + WebSocketCoreSession coreSession = newWebSocketCoreSession(frameHandler, negotiated); + wsClient.customize(coreSession); - WebSocketConnection wsConnection = newWebSocketConnection(endp, httpClient.getExecutor(), httpClient.getScheduler(), httpClient.getByteBufferPool(), wsSession); + WebSocketConnection wsConnection = newWebSocketConnection(endp, httpClient.getExecutor(), httpClient.getScheduler(), httpClient.getByteBufferPool(), coreSession); for (Connection.Listener listener : wsClient.getBeans(Connection.Listener.class)) wsConnection.addListener(listener); - wsSession.setWebSocketConnection(wsConnection); + coreSession.setWebSocketConnection(wsConnection); notifyUpgradeListeners((listener) -> listener.onHandshakeResponse(this, response)); @@ -363,7 +363,7 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon try { endp.upgrade(wsConnection); - futureCoreSession.complete(wsSession); + futureCoreSession.complete(coreSession); } catch (Throwable t) { @@ -380,9 +380,9 @@ public abstract class ClientUpgradeRequest extends HttpRequest implements Respon { } - protected WebSocketConnection newWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession wsCoreSession) + protected WebSocketConnection newWebSocketConnection(EndPoint endp, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) { - return new WebSocketConnection(endp, executor, scheduler, byteBufferPool, wsCoreSession); + return new WebSocketConnection(endp, executor, scheduler, byteBufferPool, coreSession); } protected WebSocketCoreSession newWebSocketCoreSession(FrameHandler handler, Negotiated negotiated) diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java index 3a9a2c680fb..0767365cbc7 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/client/WebSocketCoreClient.java @@ -72,10 +72,10 @@ public class WebSocketCoreClient extends ContainerLifeCycle implements FrameHand } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { if (customizer != null) - customizer.customize(session); + customizer.customize(coreSession); } public CompletableFuture connect(FrameHandler frameHandler, URI wsUri) throws IOException diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java index a4ca7786b52..97c1a20d2c3 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/ExtensionStack.java @@ -243,7 +243,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable outgoing.sendFrame(frame, callback, batch); } - public void initialize(IncomingFrames incoming, OutgoingFrames outgoing, WebSocketCoreSession webSocketCoreSession) + public void initialize(IncomingFrames incoming, OutgoingFrames outgoing, WebSocketCoreSession coreSession) { if (extensions == null) throw new IllegalStateException(); @@ -259,7 +259,7 @@ public class ExtensionStack implements IncomingFrames, OutgoingFrames, Dumpable } for (Extension extension : extensions) - extension.setWebSocketCoreSession(webSocketCoreSession); + extension.setWebSocketCoreSession(coreSession); } @Override diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java index 5f8d801d0e7..c3b86eae260 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/WebSocketConnection.java @@ -58,7 +58,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio private final ByteBufferPool bufferPool; private final Generator generator; private final Parser parser; - private final WebSocketCoreSession session; + private final WebSocketCoreSession coreSession; private final Flusher flusher; private final Random random; @@ -110,7 +110,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio this.bufferPool = bufferPool; - this.session = coreSession; + this.coreSession = coreSession; this.generator = new Generator(bufferPool); this.parser = new Parser(bufferPool, coreSession.isAutoFragment()) @@ -128,7 +128,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio this.flusher = new Flusher(scheduler, coreSession.getOutputBufferSize(), generator, endp); this.setInputBufferSize(coreSession.getInputBufferSize()); - this.random = this.session.getBehavior() == Behavior.CLIENT?new Random(endp.hashCode()):null; + this.random = this.coreSession.getBehavior() == Behavior.CLIENT?new Random(endp.hashCode()):null; } @Override @@ -173,8 +173,8 @@ public class WebSocketConnection extends AbstractConnection implements Connectio if (LOG.isDebugEnabled()) LOG.debug("onClose() of physical connection"); - if (!session.isClosed()) - session.onEof(); + if (!coreSession.isClosed()) + coreSession.onEof(); flusher.onClose(cause); super.onClose(cause); } @@ -187,7 +187,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio LOG.debug("onIdleExpired()"); // treat as a handler error because socket is still open - session.processHandlerError(new WebSocketTimeoutException("Connection Idle Timeout"),Callback.NOOP); + coreSession.processHandlerError(new WebSocketTimeoutException("Connection Idle Timeout"),Callback.NOOP); return true; } @@ -203,7 +203,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio LOG.debug("onReadTimeout()"); // treat as a handler error because socket is still open - session.processHandlerError(new WebSocketTimeoutException("Timeout on Read", timeout),Callback.NOOP); + coreSession.processHandlerError(new WebSocketTimeoutException("Timeout on Read", timeout),Callback.NOOP); return false; } @@ -216,7 +216,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio if (referenced != null) referenced.retain(); - session.onFrame(frame, new Callback() + coreSession.onFrame(frame, new Callback() { @Override public void succeeded() @@ -228,7 +228,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio if (referenced != null) referenced.release(); - if (!session.isDemanding()) + if (!coreSession.isDemanding()) demand(1); } @@ -243,7 +243,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio referenced.release(); // notify session & endpoint - session.processHandlerError(cause,NOOP); + coreSession.processHandlerError(cause,NOOP); } }); } @@ -435,7 +435,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio if (filled < 0) { releaseNetworkBuffer(); - session.onEof(); + coreSession.onEof(); return; } @@ -454,7 +454,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio LOG.warn(t.toString()); BufferUtil.clear(networkBuffer.getBuffer()); releaseNetworkBuffer(); - session.processConnectionError(t,Callback.NOOP); + coreSession.processConnectionError(t,Callback.NOOP); } } @@ -496,7 +496,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio // Open Session super.onOpen(); - session.onOpen(); + coreSession.onOpen(); } @Override @@ -527,7 +527,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio return String.format("%s@%x[%s,p=%s,f=%s,g=%s]", getClass().getSimpleName(), hashCode(), - session.getBehavior(), + coreSession.getBehavior(), parser, flusher, generator); @@ -586,7 +586,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio */ void enqueueFrame(Frame frame, Callback callback, boolean batch) { - if (session.getBehavior() == Behavior.CLIENT) + if (coreSession.getBehavior() == Behavior.CLIENT) { byte[] mask = new byte[4]; random.nextBytes(mask); @@ -607,7 +607,7 @@ public class WebSocketConnection extends AbstractConnection implements Connectio @Override public void onCompleteFailure(Throwable x) { - session.processConnectionError(x, NOOP); + coreSession.processConnectionError(x, NOOP); super.onCompleteFailure(x); } } diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/compress/CompressExtension.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/compress/CompressExtension.java index 0e95fa999ef..ff6e2657748 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/compress/CompressExtension.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/internal/compress/CompressExtension.java @@ -101,9 +101,9 @@ public abstract class CompressExtension extends AbstractExtension } @Override - public void setWebSocketCoreSession(WebSocketCoreSession webSocketCoreSession) + public void setWebSocketCoreSession(WebSocketCoreSession coreSession) { - super.setWebSocketCoreSession(webSocketCoreSession); + super.setWebSocketCoreSession(coreSession); } public Deflater getDeflater() diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java index 65272a26112..cdf36e3824a 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/WebSocketNegotiator.java @@ -18,14 +18,14 @@ package org.eclipse.jetty.websocket.core.server; +import java.io.IOException; +import java.util.function.Function; + import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.util.DecoratedObjectFactory; import org.eclipse.jetty.websocket.core.FrameHandler; import org.eclipse.jetty.websocket.core.WebSocketExtensionRegistry; -import java.io.IOException; -import java.util.function.Function; - public interface WebSocketNegotiator extends FrameHandler.Customizer { FrameHandler negotiate(Negotiation negotiation) throws IOException; @@ -102,10 +102,10 @@ public interface WebSocketNegotiator extends FrameHandler.Customizer } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { if (customizer != null) - customizer.customize(session); + customizer.customize(coreSession); } @Override diff --git a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java index 35ecf926380..74e606c6964 100644 --- a/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java +++ b/jetty-websocket/websocket-core/src/main/java/org/eclipse/jetty/websocket/core/server/internal/RFC6455Handshaker.java @@ -193,16 +193,16 @@ public final class RFC6455Handshaker implements Handshaker WebSocketConstants.SPEC_VERSION_STRING); // Create the Session - WebSocketCoreSession session = newWebSocketCoreSession(handler, negotiated); + WebSocketCoreSession coreSession = newWebSocketCoreSession(handler, negotiated); if (defaultCustomizer!=null) - defaultCustomizer.customize(session); - negotiator.customize(session); + defaultCustomizer.customize(coreSession); + negotiator.customize(coreSession); if (LOG.isDebugEnabled()) - LOG.debug("session {}", session); + LOG.debug("session {}", coreSession); // Create a connection - WebSocketConnection connection = newWebSocketConnection(httpChannel.getEndPoint(), connector.getExecutor(), connector.getScheduler(), connector.getByteBufferPool(), session); + WebSocketConnection connection = newWebSocketConnection(httpChannel.getEndPoint(), connector.getExecutor(), connector.getScheduler(), connector.getByteBufferPool(), coreSession); if (LOG.isDebugEnabled()) LOG.debug("connection {}", connection); if (connection == null) @@ -211,7 +211,7 @@ public final class RFC6455Handshaker implements Handshaker for (Connection.Listener listener : connector.getBeans(Connection.Listener.class)) connection.addListener(listener); - session.setWebSocketConnection(connection); + coreSession.setWebSocketConnection(connection); // send upgrade response Response baseResponse = baseRequest.getResponse(); @@ -231,7 +231,7 @@ public final class RFC6455Handshaker implements Handshaker // upgrade if (LOG.isDebugEnabled()) - LOG.debug("upgrade connection={} session={}", connection, session); + LOG.debug("upgrade connection={} session={}", connection, coreSession); baseRequest.setAttribute(HttpConnection.UPGRADE_CONNECTION_ATTRIBUTE, connection); return true; @@ -242,9 +242,9 @@ public final class RFC6455Handshaker implements Handshaker return new WebSocketCoreSession(handler, Behavior.SERVER, negotiated); } - protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession wsCoreSession) + protected WebSocketConnection newWebSocketConnection(EndPoint endPoint, Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, WebSocketCoreSession coreSession) { - return new WebSocketConnection(endPoint, executor, scheduler, byteBufferPool, wsCoreSession); + return new WebSocketConnection(endPoint, executor, scheduler, byteBufferPool, coreSession); } private boolean getSendServerVersion(Connector connector) diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AbstractTestFrameHandler.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AbstractTestFrameHandler.java index e9809c31466..cb3bdecc797 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AbstractTestFrameHandler.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/AbstractTestFrameHandler.java @@ -41,17 +41,17 @@ public class AbstractTestFrameHandler implements SynchronousFrameHandler private byte partial = OpCode.UNDEFINED; private Utf8StringBuilder utf8; private ByteBuffer byteBuffer; - private FrameHandler.CoreSession session; + private FrameHandler.CoreSession coreSession; public FrameHandler.CoreSession getCoreSession() { - return session; + return coreSession; } @Override public void onOpen(CoreSession coreSession) { - this.session = coreSession; + this.coreSession = coreSession; onOpen(); } @@ -121,7 +121,7 @@ public class AbstractTestFrameHandler implements SynchronousFrameHandler try { - session.sendFrame(new Frame(PONG).setPayload(pongBuf), callback, false); + coreSession.sendFrame(new Frame(PONG).setPayload(pongBuf), callback, false); } catch (Throwable t) { @@ -338,7 +338,7 @@ public class AbstractTestFrameHandler implements SynchronousFrameHandler } if (respond > 0) - session.close(respond, reason, callback); + coreSession.close(respond, reason, callback); else callback.succeeded(); } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java index cee0f559c12..74d5dbf65de 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorFrameFlagsTest.java @@ -41,7 +41,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows; public class GeneratorFrameFlagsTest { private static ByteBufferPool bufferPool = new MappedByteBufferPool(); - private WebSocketCoreSession session; + private WebSocketCoreSession coreSession; public static Stream data() { @@ -65,7 +65,7 @@ public class GeneratorFrameFlagsTest { ExtensionStack exStack = new ExtensionStack(new WebSocketExtensionRegistry(), Behavior.SERVER); exStack.negotiate(new DecoratedObjectFactory(), bufferPool, new LinkedList<>(), new LinkedList<>()); - this.session = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.CLIENT, Negotiated.from(exStack)); + this.coreSession = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.CLIENT, Negotiated.from(exStack)); } @ParameterizedTest @@ -76,6 +76,6 @@ public class GeneratorFrameFlagsTest ByteBuffer buffer = ByteBuffer.allocate(100); new Generator(bufferPool).generateWholeFrame(invalidFrame, buffer); - assertThrows(ProtocolException.class, () -> session.assertValidOutgoing(invalidFrame)); + assertThrows(ProtocolException.class, () -> coreSession.assertValidOutgoing(invalidFrame)); } } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java index c35e0bb2fc7..83d494daa55 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/GeneratorTest.java @@ -50,7 +50,7 @@ public class GeneratorTest private static final Logger LOG = Log.getLogger(Helper.class); private static Generator generator = new Generator(new MappedByteBufferPool()); - private static WebSocketCoreSession session = newWebSocketCoreSession(Behavior.SERVER); + private static WebSocketCoreSession coreSession = newWebSocketCoreSession(Behavior.SERVER); private static WebSocketCoreSession newWebSocketCoreSession(Behavior behavior) { @@ -410,7 +410,7 @@ public class GeneratorTest BufferUtil.flipToFlush(bb, 0); closeFrame.setPayload(bb); - assertThrows(ProtocolException.class, () -> session.assertValidOutgoing(closeFrame)); + assertThrows(ProtocolException.class, () -> coreSession.assertValidOutgoing(closeFrame)); } /** @@ -651,7 +651,7 @@ public class GeneratorTest Frame pingFrame = new Frame(OpCode.PING); pingFrame.setPayload(ByteBuffer.wrap(bytes)); - assertThrows(WebSocketException.class, () -> session.assertValidOutgoing(pingFrame)); + assertThrows(WebSocketException.class, () -> coreSession.assertValidOutgoing(pingFrame)); } /** @@ -665,7 +665,7 @@ public class GeneratorTest Frame pongFrame = new Frame(OpCode.PONG); pongFrame.setPayload(ByteBuffer.wrap(bytes)); - assertThrows(WebSocketException.class, () -> session.assertValidOutgoing(pongFrame)); + assertThrows(WebSocketException.class, () -> coreSession.assertValidOutgoing(pongFrame)); } /** diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java index a8b002ae6bb..b947c9590e5 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/MessageHandlerTest.java @@ -50,7 +50,7 @@ public class MessageHandlerTest boolean demanding; int demand; - CoreSession session; + CoreSession coreSession; List textMessages = new ArrayList<>(); List binaryMessages = new ArrayList<>(); List callbacks = new ArrayList<>(); @@ -63,7 +63,7 @@ public class MessageHandlerTest demanding = false; demand = 0; - session = new CoreSession.Empty() + coreSession = new CoreSession.Empty() { private ByteBufferPool byteBufferPool = new MappedByteBufferPool(); @@ -110,7 +110,7 @@ public class MessageHandlerTest } }; - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); } @Test @@ -349,7 +349,7 @@ public class MessageHandlerTest FutureCallback callback; handler.setMaxTextMessageSize(4); - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); callback = new FutureCallback(); handler.onFrame(new Frame(OpCode.TEXT, true, "Testing"), callback); @@ -368,7 +368,7 @@ public class MessageHandlerTest FutureCallback callback; handler.setMaxTextMessageSize(4); - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); callback = new FutureCallback(); handler.onFrame(new Frame(OpCode.TEXT, false, "123"), callback); @@ -569,7 +569,7 @@ public class MessageHandlerTest FutureCallback callback; handler.setMaxBinaryMessageSize(4); - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); callback = new FutureCallback(); handler.onFrame(new Frame(OpCode.BINARY, true, "Testing"), callback); @@ -588,7 +588,7 @@ public class MessageHandlerTest FutureCallback callback; handler.setMaxBinaryMessageSize(4); - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); callback = new FutureCallback(); handler.onFrame(new Frame(OpCode.BINARY, false, "123"), callback); @@ -652,7 +652,7 @@ public class MessageHandlerTest } }; - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); FutureCallback callback; @@ -680,7 +680,7 @@ public class MessageHandlerTest } }; - handler.onOpen(session, NOOP); + handler.onOpen(coreSession, NOOP); FutureCallback callback; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java index 56bc21f0426..dd69132ca64 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/ParserCapture.java @@ -37,7 +37,7 @@ import static org.hamcrest.Matchers.is; public class ParserCapture { private final Parser parser; - private final WebSocketCoreSession session; + private final WebSocketCoreSession coreSession; public BlockingQueue framesQueue = new LinkedBlockingDeque<>(); public boolean closed = false; public boolean copy; @@ -60,7 +60,7 @@ public class ParserCapture ByteBufferPool bufferPool = new MappedByteBufferPool(); ExtensionStack exStack = new ExtensionStack(new WebSocketExtensionRegistry(), Behavior.SERVER); exStack.negotiate(new DecoratedObjectFactory(), bufferPool, new LinkedList<>(), new LinkedList<>()); - this.session = new WebSocketCoreSession(new AbstractTestFrameHandler(), behavior, Negotiated.from(exStack)); + this.coreSession = new WebSocketCoreSession(new AbstractTestFrameHandler(), behavior, Negotiated.from(exStack)); } public void parse(ByteBuffer buffer) @@ -71,7 +71,7 @@ public class ParserCapture if (frame == null) break; - session.assertValidIncoming(frame); + coreSession.assertValidIncoming(frame); if (!onFrame(frame)) break; diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java index 3c2fb899dc8..6f8b70202b3 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestFrameHandler.java @@ -31,7 +31,7 @@ public class TestFrameHandler implements SynchronousFrameHandler { private static Logger LOG = Log.getLogger(TestFrameHandler.class); - protected CoreSession session; + protected CoreSession coreSession; public BlockingQueue receivedFrames = new BlockingArrayQueue<>(); protected Throwable failure; @@ -41,7 +41,7 @@ public class TestFrameHandler implements SynchronousFrameHandler public CoreSession getCoreSession() { - return session; + return coreSession; } public BlockingQueue getFrames() @@ -58,7 +58,7 @@ public class TestFrameHandler implements SynchronousFrameHandler public void onOpen(CoreSession coreSession) { LOG.info("onOpen {}", coreSession); - this.session = coreSession; + this.coreSession = coreSession; open.countDown(); } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java index 5e295cd5242..9604bc6ff8f 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/TestWebSocketNegotiator.java @@ -62,7 +62,7 @@ public class TestWebSocketNegotiator implements WebSocketNegotiator } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java index 492d8786670..a20d67be8fc 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketCloseTest.java @@ -413,7 +413,7 @@ public class WebSocketCloseTest extends WebSocketTester static class DemandingTestFrameHandler implements SynchronousFrameHandler { - private CoreSession session; + private CoreSession coreSession; String state; protected BlockingQueue receivedFrames = new BlockingArrayQueue<>(); @@ -425,7 +425,7 @@ public class WebSocketCloseTest extends WebSocketTester public CoreSession getCoreSession() { - return session; + return coreSession; } public BlockingQueue getFrames() @@ -437,8 +437,8 @@ public class WebSocketCloseTest extends WebSocketTester public void onOpen(CoreSession coreSession) { LOG.debug("onOpen {}", coreSession); - session = coreSession; - state = session.toString(); + this.coreSession = coreSession; + state = this.coreSession.toString(); opened.countDown(); } @@ -446,7 +446,7 @@ public class WebSocketCloseTest extends WebSocketTester public void onFrame(Frame frame, Callback callback) { LOG.debug("onFrame: " + BufferUtil.toDetailString(frame.getPayload())); - state = session.toString(); + state = coreSession.toString(); receivedCallback.offer(callback); receivedFrames.offer(Frame.copy(frame)); @@ -458,7 +458,7 @@ public class WebSocketCloseTest extends WebSocketTester public void onClosed(CloseStatus closeStatus) { LOG.debug("onClosed {}", closeStatus); - state = session.toString(); + state = coreSession.toString(); this.closeStatus = closeStatus; closed.countDown(); } @@ -468,7 +468,7 @@ public class WebSocketCloseTest extends WebSocketTester { LOG.debug("onError {} ", cause); error = cause; - state = session.toString(); + state = coreSession.toString(); } @Override @@ -484,7 +484,7 @@ public class WebSocketCloseTest extends WebSocketTester frame.setPayload(text); getCoreSession().sendFrame(frame, NOOP, false); - state = session.toString(); + state = coreSession.toString(); } } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java index 1ea6cf65c5f..72a418cff99 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/WebSocketOpenTest.java @@ -158,12 +158,12 @@ public class WebSocketOpenTest extends WebSocketTester return null; }); - FrameHandler.CoreSession session = sx.exchange(null); + FrameHandler.CoreSession coreSession = sx.exchange(null); Callback onOpenCallback = cx.exchange(null); Thread.sleep(100); // Can send while onOpen is active - WebSocketOpenTest.TestFrameHandler.sendText(session,"Hello", NOOP); + WebSocketOpenTest.TestFrameHandler.sendText(coreSession,"Hello", NOOP); Parser.ParsedFrame frame = receiveFrame(client.getInputStream()); assertThat(frame.getPayloadAsUTF8(),is("Hello")); @@ -172,16 +172,16 @@ public class WebSocketOpenTest extends WebSocketTester assertFalse(serverHandler.onClosed.await(1, TimeUnit.SECONDS)); // Can't demand until open - assertThrows(Throwable.class, () -> session.demand(1)); + assertThrows(Throwable.class, () -> coreSession.demand(1)); client.getOutputStream().write(RawFrameBuilder.buildClose(new CloseStatus(CloseStatus.NORMAL), true)); assertFalse(serverHandler.onClosed.await(1, TimeUnit.SECONDS)); // Succeeded moves to OPEN state and still does not read CLOSE frame onOpenCallback.succeeded(); - assertThat(session.toString(),containsString("OPEN")); + assertThat(coreSession.toString(),containsString("OPEN")); // Demand start receiving frames - session.demand(1); + coreSession.demand(1); client.getOutputStream().write(RawFrameBuilder.buildClose(new CloseStatus(CloseStatus.NORMAL), true)); assertTrue(serverHandler.onClosed.await(5, TimeUnit.SECONDS)); @@ -198,7 +198,7 @@ public class WebSocketOpenTest extends WebSocketTester static class TestFrameHandler implements SynchronousFrameHandler { - private CoreSession session; + private CoreSession coreSession; private BiFunction onOpen; private CloseStatus closeStatus; private CountDownLatch onClosed = new CountDownLatch(1); @@ -211,7 +211,7 @@ public class WebSocketOpenTest extends WebSocketTester { synchronized (this) { - return session; + return coreSession; } } @@ -226,7 +226,7 @@ public class WebSocketOpenTest extends WebSocketTester LOG.info("onOpen {}", coreSession); synchronized (this) { - session = coreSession; + this.coreSession = coreSession; } onOpen.apply(coreSession, callback); } @@ -271,25 +271,25 @@ public class WebSocketOpenTest extends WebSocketTester public void sendText(String text) { - sendText(session, text); + sendText(coreSession, text); } public void sendText(String text, Callback callback) { - sendText(session, text, callback); + sendText(coreSession, text, callback); } - static void sendText(FrameHandler.CoreSession session, String text) + static void sendText(FrameHandler.CoreSession coreSession, String text) { - sendText(session, text, NOOP); + sendText(coreSession, text, NOOP); } - static void sendText(FrameHandler.CoreSession session, String text, Callback callback) + static void sendText(FrameHandler.CoreSession coreSession, String text, Callback callback) { Frame frame = new Frame(OpCode.TEXT); frame.setFin(true); frame.setPayload(text); - session.sendFrame(frame, callback, false); + coreSession.sendFrame(frame, callback, false); } } } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketNegotiator.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketNegotiator.java index 7b81b881390..26bc2dd8b5a 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketNegotiator.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/autobahn/AutobahnWebSocketNegotiator.java @@ -82,12 +82,12 @@ class AutobahnWebSocketNegotiator implements WebSocketNegotiator } @Override - public void customize(FrameHandler.CoreSession session) + public void customize(FrameHandler.CoreSession coreSession) { - session.setIdleTimeout(Duration.ofMillis(10000)); - session.setMaxTextMessageSize(Integer.MAX_VALUE); - session.setMaxBinaryMessageSize(Integer.MAX_VALUE); - session.setMaxFrameSize(65536*2); + coreSession.setIdleTimeout(Duration.ofMillis(10000)); + coreSession.setMaxTextMessageSize(Integer.MAX_VALUE); + coreSession.setMaxBinaryMessageSize(Integer.MAX_VALUE); + coreSession.setMaxFrameSize(65536*2); } @Override diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/DeflateFrameExtensionTest.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/DeflateFrameExtensionTest.java index 8003ce5fdc4..73091a5311c 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/DeflateFrameExtensionTest.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/DeflateFrameExtensionTest.java @@ -422,8 +422,8 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest ExtensionStack exStack = new ExtensionStack(new WebSocketExtensionRegistry(), Behavior.SERVER); exStack.negotiate(new DecoratedObjectFactory(), bufferPool, new LinkedList<>(), new LinkedList<>()); - WebSocketCoreSession session = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.SERVER, Negotiated.from(exStack)); - session.setMaxFrameSize(maxMessageSize); - return session; + WebSocketCoreSession coreSession = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.SERVER, Negotiated.from(exStack)); + coreSession.setMaxFrameSize(maxMessageSize); + return coreSession; } } diff --git a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java index 8241f819826..4862ec9e12f 100644 --- a/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java +++ b/jetty-websocket/websocket-core/src/test/java/org/eclipse/jetty/websocket/core/extensions/ExtensionTool.java @@ -155,7 +155,7 @@ public class ExtensionTool ByteBufferPool bufferPool = new MappedByteBufferPool(); ExtensionStack exStack = new ExtensionStack(new WebSocketExtensionRegistry(), Behavior.SERVER); exStack.negotiate(new DecoratedObjectFactory(), bufferPool, new LinkedList<>(), new LinkedList<>()); - WebSocketCoreSession session = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.SERVER, Negotiated.from(exStack)); - return session; + WebSocketCoreSession coreSession = new WebSocketCoreSession(new AbstractTestFrameHandler(), Behavior.SERVER, Negotiated.from(exStack)); + return coreSession; } }