diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 22cb585c28b..f30f2b47cc9 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -19,6 +19,7 @@ websocket-client websocket-server websocket-servlet + websocket-mux-extension javax-websocket-client-impl javax-websocket-server-impl diff --git a/jetty-websocket/websocket-mux-extension/pom.xml b/jetty-websocket/websocket-mux-extension/pom.xml new file mode 100644 index 00000000000..6a7b8675b69 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/pom.xml @@ -0,0 +1,56 @@ + + + + org.eclipse.jetty.websocket + websocket-parent + 9.1.0-SNAPSHOT + + + 4.0.0 + websocket-mux-extension + Jetty :: Websocket :: Mux Extension + + + ${project.groupId}.mux + + + + + org.eclipse.jetty + jetty-server + ${project.version} + + + org.eclipse.jetty.websocket + websocket-client + ${project.version} + + + org.eclipse.jetty.websocket + websocket-server + ${project.version} + + + org.eclipse.jetty.toolchain + jetty-test-helper + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + tests-jar + + test-jar + + + + + + + diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java similarity index 97% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java index f6db8aff367..d57559b9c3d 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/AbstractMuxExtension.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import org.eclipse.jetty.websocket.api.WriteCallback; import org.eclipse.jetty.websocket.api.extensions.Frame; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java similarity index 99% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java index 88233ce7d55..41014b755cf 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxChannel.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.net.InetSocketAddress; import java.util.concurrent.Executor; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java index 7e364a4ca6a..230a867cd70 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxControlBlock.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; public interface MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java index ff8469fcff9..162361f3c39 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxException.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import org.eclipse.jetty.websocket.api.WebSocketException; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java index cf12f371833..7b86cbe5dcc 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGenerator.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.io.IOException; import java.nio.ByteBuffer; @@ -28,11 +28,11 @@ import org.eclipse.jetty.websocket.api.WriteCallback; import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; import org.eclipse.jetty.websocket.common.WebSocketFrame; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.mux.op.MuxNewChannelSlot; /** * Generate Mux frames destined for the physical connection. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java similarity index 94% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java index f41383ad45e..17b61a737d6 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxOp.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; public final class MuxOp { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java index 0fb2a498846..f060ec1c254 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParser.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.nio.ByteBuffer; @@ -26,11 +26,11 @@ import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.common.OpCode; import org.eclipse.jetty.websocket.common.WebSocketFrame; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.mux.op.MuxNewChannelSlot; public class MuxParser { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java similarity index 91% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java index a472cb25215..d808dfe8a60 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxPhysicalConnectionException.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java @@ -16,9 +16,9 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.mux.op.MuxDropChannel; public class MuxPhysicalConnectionException extends MuxException { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java similarity index 96% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java index 1b430e5c0f8..deb623f78c1 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxRequest.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.nio.ByteBuffer; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java index 0a34448da3e..cd2eaf6da48 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxResponse.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import org.eclipse.jetty.websocket.api.UpgradeResponse; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java similarity index 97% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java index 219b6b74f79..aef64d296f8 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxedFrame.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import org.eclipse.jetty.websocket.common.OpCode; import org.eclipse.jetty.websocket.common.WebSocketFrame; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java index 2d204dd1713..28bed381807 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/Muxer.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.io.IOException; import java.net.InetSocketAddress; @@ -38,13 +38,13 @@ import org.eclipse.jetty.websocket.api.extensions.IncomingFrames; import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; import org.eclipse.jetty.websocket.common.LogicalConnection; import org.eclipse.jetty.websocket.common.WebSocketFrame; -import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddClient; -import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddServer; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.mux.add.MuxAddClient; +import org.eclipse.jetty.websocket.mux.add.MuxAddServer; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.mux.op.MuxNewChannelSlot; /** * Muxer responsible for managing sub-channels. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java similarity index 87% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java index 155c615f207..6fa1d35073c 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddClient.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import org.eclipse.jetty.websocket.common.WebSocketSession; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; /** * Interface for Mux Client to handle receiving a AddChannelResponse diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java similarity index 86% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java index fa5b4f88b4f..89980aff054 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxAddServer.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java @@ -16,16 +16,16 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import java.io.IOException; import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeResponse; import org.eclipse.jetty.websocket.common.WebSocketSession; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.mux.MuxChannel; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.Muxer; /** * Server interface, for dealing with incoming AddChannelRequest / AddChannelResponse flows. diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/package-info.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java index 87985efb123..1834e97ded6 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/add/package-info.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java @@ -19,5 +19,5 @@ /** * Jetty WebSocket Common : MUX Extension Add Channel Handling [Unstable Early Draft] */ -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientAddHandler.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java similarity index 84% rename from jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientAddHandler.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java index bd9b5620e86..daa0ac3efc3 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientAddHandler.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java @@ -16,11 +16,11 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.client.mux; +package org.eclipse.jetty.websocket.mux.client; import org.eclipse.jetty.websocket.common.WebSocketSession; -import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddClient; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.add.MuxAddClient; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; public class MuxClientAddHandler implements MuxAddClient { diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java similarity index 83% rename from jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientExtension.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java index 58cec30a5f0..fd03392b03e 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/MuxClientExtension.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.client.mux; +package org.eclipse.jetty.websocket.mux.client; -import org.eclipse.jetty.websocket.common.extensions.mux.AbstractMuxExtension; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.mux.AbstractMuxExtension; +import org.eclipse.jetty.websocket.mux.Muxer; public class MuxClientExtension extends AbstractMuxExtension { diff --git a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java similarity index 94% rename from jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/package-info.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java index 6df80bb5202..e8d7942c39d 100644 --- a/jetty-websocket/websocket-client/src/main/java/org/eclipse/jetty/websocket/client/mux/package-info.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java @@ -19,5 +19,5 @@ /** * Jetty WebSocket Client : MUX Extension [Unstable Early Draft] */ -package org.eclipse.jetty.websocket.client.mux; +package org.eclipse.jetty.websocket.mux.client; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java similarity index 92% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java index 64fb9282802..4647c5b967a 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelRequest.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxOp; public class MuxAddChannelRequest implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java index a30b6ecf7ba..b2a2dd64f76 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxAddChannelResponse.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; import java.nio.ByteBuffer; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.StringUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxOp; public class MuxAddChannelResponse implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java similarity index 95% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java index 1d062e1b7bb..edd186fe4ef 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxDropChannel.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java @@ -16,14 +16,14 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; import java.nio.ByteBuffer; import java.util.HashMap; import java.util.Map; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxOp; public class MuxDropChannel implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java similarity index 88% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java index 32b6d964a16..c238c6f1c9a 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxFlowControl.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxOp; public class MuxFlowControl implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java similarity index 89% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java index 09aadf181a2..4fae241b0d9 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/MuxNewChannelSlot.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxOp; public class MuxNewChannelSlot implements MuxControlBlock { diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/package-info.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java index cd5c7ac8057..a01e182991d 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/op/package-info.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java @@ -19,5 +19,5 @@ /** * Jetty WebSocket Common : MUX Extension OpCode Handling [Unstable Early Draft] */ -package org.eclipse.jetty.websocket.common.extensions.mux.op; +package org.eclipse.jetty.websocket.mux.op; diff --git a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java similarity index 93% rename from jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/package-info.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java index 7112f3b2d45..b025466cd46 100644 --- a/jetty-websocket/websocket-common/src/main/java/org/eclipse/jetty/websocket/common/extensions/mux/package-info.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java @@ -19,5 +19,5 @@ /** * Jetty WebSocket Common : MUX Extension Core [Unstable Early Draft] */ -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/EmptyHttpInput.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java similarity index 96% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/EmptyHttpInput.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java index 14aa43d1462..f34c8731b6e 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/EmptyHttpInput.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; import java.nio.ByteBuffer; diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpChannelOverMux.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java similarity index 97% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpChannelOverMux.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java index a3c953fac7c..52345507754 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpChannelOverMux.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; import java.nio.ByteBuffer; diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpTransportOverMux.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java similarity index 93% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpTransportOverMux.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java index cc442b1c600..80addb64773 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/HttpTransportOverMux.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; import java.io.IOException; import java.nio.ByteBuffer; @@ -28,8 +28,8 @@ import org.eclipse.jetty.util.BlockingCallback; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.mux.MuxChannel; +import org.eclipse.jetty.websocket.mux.Muxer; /** * Take {@link ResponseInfo} objects and convert to bytes for response. diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxAddHandler.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java similarity index 92% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxAddHandler.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java index 4f46b9d6da9..15b88cf727f 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxAddHandler.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; import java.io.IOException; @@ -30,10 +30,10 @@ import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.websocket.api.UpgradeRequest; import org.eclipse.jetty.websocket.api.UpgradeResponse; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.common.extensions.mux.add.MuxAddServer; +import org.eclipse.jetty.websocket.mux.MuxChannel; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.Muxer; +import org.eclipse.jetty.websocket.mux.add.MuxAddServer; /** * Handler for incoming MuxAddChannel requests. diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxServerExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java similarity index 83% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxServerExtension.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java index 1aa510d7a7f..61562b2d252 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/MuxServerExtension.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java @@ -16,10 +16,10 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; -import org.eclipse.jetty.websocket.common.extensions.mux.AbstractMuxExtension; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; +import org.eclipse.jetty.websocket.mux.AbstractMuxExtension; +import org.eclipse.jetty.websocket.mux.Muxer; public class MuxServerExtension extends AbstractMuxExtension { diff --git a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java similarity index 94% rename from jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/package-info.java rename to jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java index 34367885f53..5e44702a418 100644 --- a/jetty-websocket/websocket-server/src/main/java/org/eclipse/jetty/websocket/server/mux/package-info.java +++ b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java @@ -19,5 +19,5 @@ /** * Jetty WebSocket Server : MUX Extension [Unstable Early Draft] */ -package org.eclipse.jetty.websocket.server.mux; +package org.eclipse.jetty.websocket.mux.server; diff --git a/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.client.ClientExtension b/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.client.ClientExtension new file mode 100644 index 00000000000..8c39ac74fd2 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.client.ClientExtension @@ -0,0 +1 @@ +org.eclipse.jetty.websocket.mux.client.MuxClientExtension \ No newline at end of file diff --git a/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.server.ServerExtension b/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.server.ServerExtension new file mode 100644 index 00000000000..05c99741af7 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.server.ServerExtension @@ -0,0 +1 @@ +org.eclipse.jetty.websocket.mux.client.MuxServerExtension \ No newline at end of file diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/examples/echo/AdapterEchoSocket.java b/jetty-websocket/websocket-mux-extension/src/test/java/examples/echo/AdapterEchoSocket.java new file mode 100644 index 00000000000..ad6b3cf5292 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/examples/echo/AdapterEchoSocket.java @@ -0,0 +1,47 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package examples.echo; + +import java.io.IOException; + +import org.eclipse.jetty.websocket.api.WebSocketAdapter; + +/** + * Example EchoSocket using Adapter. + */ +public class AdapterEchoSocket extends WebSocketAdapter +{ + @Override + public void onWebSocketText(String message) + { + if (isConnected()) + { + try + { + System.out.printf("Echoing back message [%s]%n",message); + // echo the message back + getRemote().sendString(message); + } + catch (IOException e) + { + e.printStackTrace(System.err); + } + } + } +} diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxDecoder.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java similarity index 94% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxDecoder.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java index c06a7418f02..bc004089a53 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxDecoder.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java @@ -16,11 +16,12 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import org.eclipse.jetty.websocket.api.WriteCallback; import org.eclipse.jetty.websocket.api.extensions.Frame; import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; +import org.eclipse.jetty.websocket.mux.MuxParser; /** * Helpful utility class to parse arbitrary mux events from a physical connection's OutgoingFrames. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEncoder.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java similarity index 93% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEncoder.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java index 079d5e406c0..17e47688523 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEncoder.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import java.io.IOException; @@ -25,6 +25,8 @@ import org.eclipse.jetty.websocket.api.extensions.IncomingFrames; import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.io.FramePipes; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxGenerator; /** * Helpful utility class to send arbitrary mux events into a physical connection's IncomingFrames. diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEventCapture.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java similarity index 82% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEventCapture.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java index f9cfc91a4e9..f13b4ceb916 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxEventCapture.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -25,15 +25,15 @@ import java.util.LinkedList; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.websocket.common.OpCode; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxControlBlock; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxedFrame; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxDropChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxFlowControl; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxNewChannelSlot; +import org.eclipse.jetty.websocket.mux.MuxControlBlock; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.MuxParser; +import org.eclipse.jetty.websocket.mux.MuxedFrame; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.op.MuxDropChannel; +import org.eclipse.jetty.websocket.mux.op.MuxFlowControl; +import org.eclipse.jetty.websocket.mux.op.MuxNewChannelSlot; import org.junit.Assert; public class MuxEventCapture implements MuxParser.Listener diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWrite139SizeTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java similarity index 96% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWrite139SizeTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java index acdc204e653..822cd0728f1 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWrite139SizeTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -28,7 +28,7 @@ import java.util.Locale; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxGenerator; +import org.eclipse.jetty.websocket.mux.MuxGenerator; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWriteChannelIdTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWriteChannelIdTest.java similarity index 96% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWriteChannelIdTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWriteChannelIdTest.java index 4fe5fdbe8a2..aa795d1c894 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxGeneratorWriteChannelIdTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWriteChannelIdTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -28,7 +28,7 @@ import java.util.Locale; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxGenerator; +import org.eclipse.jetty.websocket.mux.MuxGenerator; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRFCTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java similarity index 98% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRFCTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java index 332fa4eb864..edea73310af 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRFCTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRFCTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -33,12 +33,12 @@ import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.api.extensions.Frame; -import org.eclipse.jetty.websocket.common.IncomingFramesCapture; import org.eclipse.jetty.websocket.common.OpCode; import org.eclipse.jetty.websocket.common.Parser; -import org.eclipse.jetty.websocket.common.UnitParser; import org.eclipse.jetty.websocket.common.WebSocketFrame; import org.eclipse.jetty.websocket.common.extensions.AbstractExtension; +import org.eclipse.jetty.websocket.mux.helper.IncomingFramesCapture; +import org.eclipse.jetty.websocket.mux.helper.UnitParser; import org.junit.Assert; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_BadEncodingTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_BadEncodingTest.java similarity index 94% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_BadEncodingTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_BadEncodingTest.java index 15c2e060acd..1ed2f7dba98 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_BadEncodingTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_BadEncodingTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -26,8 +26,8 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_GoodTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_GoodTest.java similarity index 96% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_GoodTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_GoodTest.java index eb450fc1776..d8f31583c11 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserRead139Size_GoodTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserRead139Size_GoodTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -26,7 +26,7 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_BadEncodingTest.java similarity index 94% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_BadEncodingTest.java index 57c17a3fb11..2d3e0513f58 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_BadEncodingTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_BadEncodingTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -26,8 +26,8 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_GoodTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_GoodTest.java similarity index 96% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_GoodTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_GoodTest.java index 5a1ad5e9a3c..62402cf17ba 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/MuxParserReadChannelId_GoodTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxParserReadChannelId_GoodTest.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux; +package org.eclipse.jetty.websocket.mux; import static org.hamcrest.Matchers.*; @@ -26,7 +26,7 @@ import java.util.Collection; import java.util.List; import org.eclipse.jetty.util.TypeUtil; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxParser; +import org.eclipse.jetty.websocket.mux.MuxParser; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddClient.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddClient.java similarity index 86% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddClient.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddClient.java index 81ccc3d7c3f..a7920cb6772 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddClient.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddClient.java @@ -16,10 +16,11 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import org.eclipse.jetty.websocket.common.WebSocketSession; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.add.MuxAddClient; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; public class DummyMuxAddClient implements MuxAddClient { diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddServer.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddServer.java similarity index 90% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddServer.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddServer.java index 49b4fcb8947..8f997e35fe0 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/DummyMuxAddServer.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/DummyMuxAddServer.java @@ -16,7 +16,7 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import java.io.IOException; @@ -28,10 +28,11 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.common.WebSocketSession; import org.eclipse.jetty.websocket.common.events.EventDriver; import org.eclipse.jetty.websocket.common.events.EventDriverFactory; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxException; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; +import org.eclipse.jetty.websocket.mux.MuxChannel; +import org.eclipse.jetty.websocket.mux.MuxException; +import org.eclipse.jetty.websocket.mux.Muxer; +import org.eclipse.jetty.websocket.mux.add.MuxAddServer; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; import examples.echo.AdapterEchoSocket; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddClientTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddClientTest.java similarity index 84% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddClientTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddClientTest.java index 18480e3e3d0..80d922cbf8f 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddClientTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddClientTest.java @@ -16,17 +16,17 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import org.eclipse.jetty.websocket.api.WebSocketPolicy; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxChannel; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxDecoder; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxEncoder; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.io.LocalWebSocketConnection; +import org.eclipse.jetty.websocket.mux.MuxChannel; +import org.eclipse.jetty.websocket.mux.MuxDecoder; +import org.eclipse.jetty.websocket.mux.MuxEncoder; +import org.eclipse.jetty.websocket.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.Muxer; +import org.eclipse.jetty.websocket.mux.helper.LocalWebSocketConnection; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; diff --git a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddServerTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddServerTest.java similarity index 87% rename from jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddServerTest.java rename to jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddServerTest.java index 007f58b2499..c543c4375bc 100644 --- a/jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/extensions/mux/add/MuxerAddServerTest.java +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/add/MuxerAddServerTest.java @@ -16,20 +16,20 @@ // ======================================================================== // -package org.eclipse.jetty.websocket.common.extensions.mux.add; +package org.eclipse.jetty.websocket.mux.add; import static org.hamcrest.Matchers.*; import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.eclipse.jetty.websocket.common.OpCode; import org.eclipse.jetty.websocket.common.WebSocketFrame; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxDecoder; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxEncoder; -import org.eclipse.jetty.websocket.common.extensions.mux.MuxOp; -import org.eclipse.jetty.websocket.common.extensions.mux.Muxer; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelRequest; -import org.eclipse.jetty.websocket.common.extensions.mux.op.MuxAddChannelResponse; -import org.eclipse.jetty.websocket.common.io.LocalWebSocketConnection; +import org.eclipse.jetty.websocket.mux.MuxDecoder; +import org.eclipse.jetty.websocket.mux.MuxEncoder; +import org.eclipse.jetty.websocket.mux.MuxOp; +import org.eclipse.jetty.websocket.mux.Muxer; +import org.eclipse.jetty.websocket.mux.helper.LocalWebSocketConnection; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelRequest; +import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse; import org.junit.Assert; import org.junit.Ignore; import org.junit.Rule; diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/IncomingFramesCapture.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/IncomingFramesCapture.java new file mode 100644 index 00000000000..7d34c221d20 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/IncomingFramesCapture.java @@ -0,0 +1,142 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.mux.helper; + +import static org.hamcrest.Matchers.*; + +import java.util.LinkedList; + +import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.websocket.api.WebSocketException; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.IncomingFrames; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.junit.Assert; + +public class IncomingFramesCapture implements IncomingFrames +{ + private static final Logger LOG = Log.getLogger(IncomingFramesCapture.class); + + private LinkedList frames = new LinkedList<>(); + private LinkedList errors = new LinkedList<>(); + + public void assertErrorCount(int expectedCount) + { + Assert.assertThat("Captured error count",errors.size(),is(expectedCount)); + } + + public void assertFrameCount(int expectedCount) + { + Assert.assertThat("Captured frame count",frames.size(),is(expectedCount)); + } + + public void assertHasErrors(Class errorType, int expectedCount) + { + Assert.assertThat(errorType.getSimpleName(),getErrorCount(errorType),is(expectedCount)); + } + + public void assertHasFrame(byte op) + { + Assert.assertThat(OpCode.name(op),getFrameCount(op),greaterThanOrEqualTo(1)); + } + + public void assertHasFrame(byte op, int expectedCount) + { + Assert.assertThat(OpCode.name(op),getFrameCount(op),is(expectedCount)); + } + + public void assertHasNoFrames() + { + Assert.assertThat("Has no frames",frames.size(),is(0)); + } + + public void assertNoErrors() + { + Assert.assertThat("Has no errors",errors.size(),is(0)); + } + + public void dump() + { + System.err.printf("Captured %d incoming frames%n",frames.size()); + for (int i = 0; i < frames.size(); i++) + { + Frame frame = frames.get(i); + System.err.printf("[%3d] %s%n",i,frame); + System.err.printf(" %s%n",BufferUtil.toDetailString(frame.getPayload())); + } + } + + public int getErrorCount(Class errorType) + { + int count = 0; + for (Throwable error : errors) + { + if (errorType.isInstance(error)) + { + count++; + } + } + return count; + } + + public LinkedList getErrors() + { + return errors; + } + + public int getFrameCount(byte op) + { + int count = 0; + for (WebSocketFrame frame : frames) + { + if (frame.getOpCode() == op) + { + count++; + } + } + return count; + } + + public LinkedList getFrames() + { + return frames; + } + + @Override + public void incomingError(Throwable e) + { + LOG.debug(e); + errors.add(e); + } + + @Override + public void incomingFrame(Frame frame) + { + WebSocketFrame copy = new WebSocketFrame(frame); + frames.add(copy); + } + + public int size() + { + return frames.size(); + } +} diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketConnection.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketConnection.java new file mode 100644 index 00000000000..cd862673993 --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketConnection.java @@ -0,0 +1,250 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.mux.helper; + +import java.net.InetSocketAddress; +import java.util.concurrent.Executor; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.io.MappedByteBufferPool; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; +import org.eclipse.jetty.util.thread.ExecutorThreadPool; +import org.eclipse.jetty.websocket.api.StatusCode; +import org.eclipse.jetty.websocket.api.SuspendToken; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.api.WriteCallback; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.IncomingFrames; +import org.eclipse.jetty.websocket.common.CloseInfo; +import org.eclipse.jetty.websocket.common.ConnectionState; +import org.eclipse.jetty.websocket.common.LogicalConnection; +import org.eclipse.jetty.websocket.common.WebSocketSession; +import org.eclipse.jetty.websocket.common.io.IOState; +import org.eclipse.jetty.websocket.common.io.IOState.ConnectionStateListener; +import org.junit.rules.TestName; + +public class LocalWebSocketConnection implements LogicalConnection, IncomingFrames, ConnectionStateListener +{ + private static final Logger LOG = Log.getLogger(LocalWebSocketConnection.class); + private final String id; + private final ByteBufferPool bufferPool; + private final Executor executor; + private WebSocketPolicy policy = WebSocketPolicy.newServerPolicy(); + private IncomingFrames incoming; + private IOState ioState = new IOState(); + + public LocalWebSocketConnection() + { + this("anon"); + } + + public LocalWebSocketConnection(String id) + { + this.id = id; + this.bufferPool = new MappedByteBufferPool(); + this.executor = new ExecutorThreadPool(); + this.ioState.addListener(this); + } + + public LocalWebSocketConnection(TestName testname) + { + this(testname.getMethodName()); + } + + @Override + public Executor getExecutor() + { + return executor; + } + + @Override + public void close() + { + close(StatusCode.NORMAL,null); + } + + @Override + public void close(int statusCode, String reason) + { + LOG.debug("close({}, {})",statusCode,reason); + CloseInfo close = new CloseInfo(statusCode,reason); + ioState.onCloseLocal(close); + } + + public void connect() + { + LOG.debug("connect()"); + ioState.onConnected(); + } + + @Override + public void disconnect() + { + LOG.debug("disconnect()"); + } + + @Override + public ByteBufferPool getBufferPool() + { + return this.bufferPool; + } + + @Override + public long getIdleTimeout() + { + return 0; + } + + public IncomingFrames getIncoming() + { + return incoming; + } + + @Override + public IOState getIOState() + { + return ioState; + } + + @Override + public InetSocketAddress getLocalAddress() + { + return null; + } + + @Override + public long getMaxIdleTimeout() + { + return 0; + } + + @Override + public WebSocketPolicy getPolicy() + { + return policy; + } + + @Override + public InetSocketAddress getRemoteAddress() + { + return null; + } + + @Override + public WebSocketSession getSession() + { + return null; + } + + @Override + public void incomingError(Throwable e) + { + incoming.incomingError(e); + } + + @Override + public void incomingFrame(Frame frame) + { + incoming.incomingFrame(frame); + } + + @Override + public boolean isOpen() + { + return getIOState().isOpen(); + } + + @Override + public boolean isReading() + { + return false; + } + + @Override + public void onConnectionStateChange(ConnectionState state) + { + LOG.debug("Connection State Change: {}",state); + switch (state) + { + case CLOSED: + this.disconnect(); + break; + case CLOSING: + if (ioState.wasRemoteCloseInitiated()) + { + // send response close frame + CloseInfo close = ioState.getCloseInfo(); + LOG.debug("write close frame: {}",close); + ioState.onCloseLocal(close); + } + default: + break; + } + } + + public void open() + { + LOG.debug("open()"); + ioState.onOpened(); + } + + @Override + public void outgoingFrame(Frame frame, WriteCallback callback) + { + } + + @Override + public void resume() + { + } + + @Override + public void setMaxIdleTimeout(long ms) + { + } + + @Override + public void setNextIncomingFrames(IncomingFrames incoming) + { + this.incoming = incoming; + } + + public void setPolicy(WebSocketPolicy policy) + { + this.policy = policy; + } + + @Override + public void setSession(WebSocketSession session) + { + } + + @Override + public SuspendToken suspend() + { + return null; + } + + @Override + public String toString() + { + return String.format("%s[%s]",LocalWebSocketConnection.class.getSimpleName(),id); + } +} diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketSession.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketSession.java new file mode 100644 index 00000000000..bc8ede16ade --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/LocalWebSocketSession.java @@ -0,0 +1,50 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.mux.helper; + +import java.net.URI; + +import org.eclipse.jetty.websocket.common.WebSocketSession; +import org.eclipse.jetty.websocket.common.events.EventDriver; +import org.junit.rules.TestName; + +public class LocalWebSocketSession extends WebSocketSession +{ + private String id; + private OutgoingFramesCapture outgoingCapture; + + public LocalWebSocketSession(TestName testname, EventDriver driver) + { + super(URI.create("ws://localhost/LocalWebSocketSesssion/" + testname.getMethodName()),driver,new LocalWebSocketConnection(testname)); + this.id = testname.getMethodName(); + outgoingCapture = new OutgoingFramesCapture(); + setOutgoingHandler(outgoingCapture); + } + + public OutgoingFramesCapture getOutgoingCapture() + { + return outgoingCapture; + } + + @Override + public String toString() + { + return String.format("%s[%s]",LocalWebSocketSession.class.getSimpleName(),id); + } +} diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/OutgoingFramesCapture.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/OutgoingFramesCapture.java new file mode 100644 index 00000000000..4ca586c005e --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/OutgoingFramesCapture.java @@ -0,0 +1,96 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.mux.helper; + +import static org.hamcrest.Matchers.*; + +import java.util.LinkedList; + +import org.eclipse.jetty.util.BufferUtil; +import org.eclipse.jetty.websocket.api.WriteCallback; +import org.eclipse.jetty.websocket.api.extensions.Frame; +import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames; +import org.eclipse.jetty.websocket.common.OpCode; +import org.eclipse.jetty.websocket.common.WebSocketFrame; +import org.junit.Assert; + +public class OutgoingFramesCapture implements OutgoingFrames +{ + private LinkedList frames = new LinkedList<>(); + + public void assertFrameCount(int expectedCount) + { + Assert.assertThat("Captured frame count",frames.size(),is(expectedCount)); + } + + public void assertHasFrame(byte op) + { + Assert.assertThat(OpCode.name(op),getFrameCount(op),greaterThanOrEqualTo(1)); + } + + public void assertHasFrame(byte op, int expectedCount) + { + Assert.assertThat(OpCode.name(op),getFrameCount(op),is(expectedCount)); + } + + public void assertHasNoFrames() + { + Assert.assertThat("Has no frames",frames.size(),is(0)); + } + + public void dump() + { + System.out.printf("Captured %d outgoing writes%n",frames.size()); + for (int i = 0; i < frames.size(); i++) + { + Frame frame = frames.get(i); + System.out.printf("[%3d] %s%n",i,frame); + System.out.printf(" %s%n",BufferUtil.toDetailString(frame.getPayload())); + } + } + + public int getFrameCount(byte op) + { + int count = 0; + for (WebSocketFrame frame : frames) + { + if (frame.getOpCode() == op) + { + count++; + } + } + return count; + } + + public LinkedList getFrames() + { + return frames; + } + + @Override + public void outgoingFrame(Frame frame, WriteCallback callback) + { + WebSocketFrame copy = new WebSocketFrame(frame); + frames.add(copy); + if (callback != null) + { + callback.writeSuccess(); + } + } +} diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java new file mode 100644 index 00000000000..7976515b86d --- /dev/null +++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java @@ -0,0 +1,78 @@ +// +// ======================================================================== +// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.websocket.mux.helper; + +import java.nio.ByteBuffer; + +import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.io.MappedByteBufferPool; +import org.eclipse.jetty.util.log.StacklessLogging; +import org.eclipse.jetty.websocket.api.WebSocketPolicy; +import org.eclipse.jetty.websocket.common.Parser; + +public class UnitParser extends Parser +{ + public UnitParser() + { + this(WebSocketPolicy.newServerPolicy()); + } + + public UnitParser(ByteBufferPool bufferPool, WebSocketPolicy policy) + { + super(policy,bufferPool); + } + + public UnitParser(WebSocketPolicy policy) + { + this(new MappedByteBufferPool(),policy); + } + + private void parsePartial(ByteBuffer buf, int numBytes) + { + int len = Math.min(numBytes,buf.remaining()); + byte arr[] = new byte[len]; + buf.get(arr,0,len); + this.parse(ByteBuffer.wrap(arr)); + } + + /** + * Parse a buffer, but do so in a quiet fashion, squelching stacktraces if encountered. + *

+ * Use if you know the parse will cause an exception and just don't wnat to make the test console all noisy. + */ + public void parseQuietly(ByteBuffer buf) + { + try (StacklessLogging supress = new StacklessLogging(Parser.class)) + { + parse(buf); + } + catch (Exception ignore) + { + /* ignore */ + } + } + + public void parseSlowly(ByteBuffer buf, int segmentSize) + { + while (buf.remaining() > 0) + { + parsePartial(buf,segmentSize); + } + } +}