diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml
index 73d907a455c..3719fb06c01 100644
--- a/jetty-websocket/pom.xml
+++ b/jetty-websocket/pom.xml
@@ -19,7 +19,6 @@
websocket-clientwebsocket-serverwebsocket-servlet
- websocket-mux-extensionjavax-websocket-client-impljavax-websocket-server-impl
diff --git a/jetty-websocket/websocket-mux-extension/pom.xml b/jetty-websocket/websocket-mux-extension/pom.xml
deleted file mode 100644
index 211b0c05987..00000000000
--- a/jetty-websocket/websocket-mux-extension/pom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-
-
-
- org.eclipse.jetty.websocket
- websocket-parent
- 9.1.2-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-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java
deleted file mode 100644
index 00925e29864..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/AbstractMuxExtension.java
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.api.WriteCallback;
-import org.eclipse.jetty.websocket.api.extensions.Frame;
-import org.eclipse.jetty.websocket.common.LogicalConnection;
-import org.eclipse.jetty.websocket.common.extensions.AbstractExtension;
-
-/**
- * Multiplexing Extension for WebSockets.
- *
- * Supporting draft-ietf-hybi-websocket-multiplexing-08 Specification.
- */
-public abstract class AbstractMuxExtension extends AbstractExtension
-{
- private Muxer muxer;
-
- public AbstractMuxExtension()
- {
- super();
- }
-
- public abstract void configureMuxer(Muxer muxer);
-
- @Override
- public void incomingFrame(Frame frame)
- {
- this.muxer.incomingFrame(frame);
- }
-
- @Override
- public void outgoingFrame(Frame frame, WriteCallback callback)
- {
- /* do nothing here, allow Muxer to handle this aspect */
- }
-
- @Override
- public void setConnection(LogicalConnection connection)
- {
- super.setConnection(connection);
- if (muxer != null)
- {
- throw new RuntimeException("Cannot reset muxer physical connection once established");
- }
- this.muxer = new Muxer(connection);
- configureMuxer(this.muxer);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java
deleted file mode 100644
index cbf1b04d3c6..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxChannel.java
+++ /dev/null
@@ -1,248 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.net.InetSocketAddress;
-import java.util.concurrent.Executor;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.jetty.io.ByteBufferPool;
-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;
-
-/**
- * MuxChannel, acts as WebSocketConnection for specific sub-channel.
- */
-public class MuxChannel implements LogicalConnection, IncomingFrames, SuspendToken, ConnectionStateListener
-{
- private final long channelId;
- private final Muxer muxer;
- private final AtomicBoolean suspendToken;
- private IOState ioState;
- private WebSocketPolicy policy;
- private WebSocketSession session;
- private IncomingFrames incoming;
-
- public MuxChannel(long channelId, Muxer muxer)
- {
- this.channelId = channelId;
- this.muxer = muxer;
- this.policy = muxer.getPolicy().clonePolicy();
-
- this.suspendToken = new AtomicBoolean(false);
- this.ioState = new IOState();
- this.ioState.addListener(this);
- }
-
- @Override
- public Executor getExecutor()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void close()
- {
- close(StatusCode.NORMAL,null);
- }
-
- @Override
- public void close(int statusCode, String reason)
- {
- CloseInfo close = new CloseInfo(statusCode,reason);
- // TODO: disconnect callback?
- outgoingFrame(close.asFrame(),null);
- }
-
- @Override
- public void disconnect()
- {
- // TODO: disconnect the virtual end-point?
- }
-
- @Override
- public ByteBufferPool getBufferPool()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public long getChannelId()
- {
- return channelId;
- }
-
- @Override
- public long getIdleTimeout()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public IOState getIOState()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public InetSocketAddress getLocalAddress()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public long getMaxIdleTimeout()
- {
- // TODO Auto-generated method stub
- return 0;
- }
-
- @Override
- public WebSocketPolicy getPolicy()
- {
- return policy;
- }
-
- @Override
- public InetSocketAddress getRemoteAddress()
- {
- return muxer.getRemoteAddress();
- }
-
- @Override
- public WebSocketSession getSession()
- {
- return session;
- }
-
- /**
- * Incoming exceptions from Muxer.
- */
- @Override
- public void incomingError(Throwable e)
- {
- incoming.incomingError(e);
- }
-
- /**
- * Incoming frames from Muxer
- */
- @Override
- public void incomingFrame(Frame frame)
- {
- incoming.incomingFrame(frame);
- }
-
- public boolean isActive()
- {
- return (ioState.isOpen());
- }
-
- @Override
- public boolean isOpen()
- {
- return isActive() && muxer.isOpen();
- }
-
- @Override
- public boolean isReading()
- {
- return true;
- }
-
- public void onClose()
- {
- }
-
- @Override
- public void onConnectionStateChange(ConnectionState state)
- {
- // TODO Auto-generated method stub
-
- }
-
- public void onOpen()
- {
- this.ioState.onOpened();
- }
-
- /**
- * Frames destined for the Muxer
- */
- @Override
- public void outgoingFrame(Frame frame, WriteCallback callback)
- {
- muxer.output(channelId,frame,callback);
- }
-
- @Override
- public void resume()
- {
- if (suspendToken.getAndSet(false))
- {
- // TODO: Start reading again. (how?)
- }
- }
-
- @Override
- public void setMaxIdleTimeout(long ms)
- {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setNextIncomingFrames(IncomingFrames incoming)
- {
- this.incoming = incoming;
- }
-
- @Override
- public void setSession(WebSocketSession session)
- {
- this.session = session;
- // session.setOutgoing(this);
- }
-
- public void setSubProtocol(String subProtocol)
- {
- }
-
- @Override
- public SuspendToken suspend()
- {
- suspendToken.set(true);
- // TODO: how to suspend reading?
- return this;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java
deleted file mode 100644
index 80da0171f87..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxControlBlock.java
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-public interface MuxControlBlock
-{
- public int getOpCode();
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java
deleted file mode 100644
index 88e17eb82d7..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxException.java
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.api.WebSocketException;
-
-@SuppressWarnings("serial")
-public class MuxException extends WebSocketException
-{
- public MuxException(String message)
- {
- super(message);
- }
-
- public MuxException(String message, Throwable cause)
- {
- super(message,cause);
- }
-
- public MuxException(Throwable cause)
- {
- super(cause);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java
deleted file mode 100644
index 0393a496059..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxGenerator.java
+++ /dev/null
@@ -1,272 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-import org.eclipse.jetty.io.ArrayByteBufferPool;
-import org.eclipse.jetty.io.ByteBufferPool;
-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.WebSocketFrame;
-import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
-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.
- */
-public class MuxGenerator
-{
- private static final int CONTROL_BUFFER_SIZE = 2 * 1024;
- /** 4 bytes for channel ID + 1 for fin/rsv/opcode */
- private static final int DATA_FRAME_OVERHEAD = 5;
- private ByteBufferPool bufferPool;
- private OutgoingFrames outgoing;
-
- public MuxGenerator()
- {
- this(new ArrayByteBufferPool());
- }
-
- public MuxGenerator(ByteBufferPool bufferPool)
- {
- this.bufferPool = bufferPool;
- }
-
- public void generate(long channelId, Frame frame, WriteCallback callback)
- {
- ByteBuffer muxPayload = bufferPool.acquire(frame.getPayloadLength() + DATA_FRAME_OVERHEAD,false);
- BufferUtil.flipToFill(muxPayload);
-
- // start building mux payload
- writeChannelId(muxPayload,channelId);
- byte b = (byte)(frame.isFin()?0x80:0x00); // fin
- b |= (byte)(frame.isRsv1()?0x40:0x00); // rsv1
- b |= (byte)(frame.isRsv2()?0x20:0x00); // rsv2
- b |= (byte)(frame.isRsv3()?0x10:0x00); // rsv3
- b |= (byte)(frame.getOpCode() & 0x0F); // opcode
- muxPayload.put(b);
- BufferUtil.put(frame.getPayload(),muxPayload);
-
- // build muxed frame
- WebSocketFrame muxFrame = new BinaryFrame();
- BufferUtil.flipToFlush(muxPayload,0);
- muxFrame.setPayload(muxPayload);
- // NOTE: the physical connection will handle masking rules for this frame.
-
- // release original buffer (no longer needed)
- bufferPool.release(frame.getPayload());
-
- // send muxed frame down to the physical connection.
- outgoing.outgoingFrame(muxFrame,callback);
- }
-
- public void generate(WriteCallback callback,MuxControlBlock... blocks) throws IOException
- {
- if ((blocks == null) || (blocks.length <= 0))
- {
- return; // nothing to do
- }
-
- ByteBuffer payload = bufferPool.acquire(CONTROL_BUFFER_SIZE,false);
- BufferUtil.flipToFill(payload);
-
- writeChannelId(payload,0); // control channel
-
- for (MuxControlBlock block : blocks)
- {
- switch (block.getOpCode())
- {
- case MuxOp.ADD_CHANNEL_REQUEST:
- {
- MuxAddChannelRequest op = (MuxAddChannelRequest)block;
- byte b = (byte)((op.getOpCode() & 0x07) << 5); // opcode
- b |= (byte)((op.getRsv() & 0x07) << 2); // rsv
- b |= (op.getEncoding() & 0x03); // enc
- payload.put(b); // opcode + rsv + enc
- writeChannelId(payload,op.getChannelId());
- write139Buffer(payload,op.getHandshake());
- break;
- }
- case MuxOp.ADD_CHANNEL_RESPONSE:
- {
- MuxAddChannelResponse op = (MuxAddChannelResponse)block;
- byte b = (byte)((op.getOpCode() & 0x07) << 5); // opcode
- b |= (op.isFailed()?0x10:0x00); // failure bit
- b |= (byte)((op.getRsv() & 0x03) << 2); // rsv
- b |= (op.getEncoding() & 0x03); // enc
- payload.put(b); // opcode + f + rsv + enc
- writeChannelId(payload,op.getChannelId());
- if (op.getHandshake() != null)
- {
- write139Buffer(payload,op.getHandshake());
- }
- else
- {
- // no handshake details
- write139Size(payload,0);
- }
- break;
- }
- case MuxOp.DROP_CHANNEL:
- {
- MuxDropChannel op = (MuxDropChannel)block;
- byte b = (byte)((op.getOpCode() & 0x07) << 5); // opcode
- b |= (byte)(op.getRsv() & 0x1F); // rsv
- payload.put(b); // opcode + rsv
- writeChannelId(payload,op.getChannelId());
- write139Buffer(payload,op.asReasonBuffer());
- break;
- }
- case MuxOp.FLOW_CONTROL:
- {
- MuxFlowControl op = (MuxFlowControl)block;
- byte b = (byte)((op.getOpCode() & 0x07) << 5); // opcode
- b |= (byte)(op.getRsv() & 0x1F); // rsv
- payload.put(b); // opcode + rsv
- writeChannelId(payload,op.getChannelId());
- write139Size(payload,op.getSendQuotaSize());
- break;
- }
- case MuxOp.NEW_CHANNEL_SLOT:
- {
- MuxNewChannelSlot op = (MuxNewChannelSlot)block;
- byte b = (byte)((op.getOpCode() & 0x07) << 5); // opcode
- b |= (byte)(op.getRsv() & 0x0F) << 1; // rsv
- b |= (byte)(op.isFallback()?0x01:0x00); // fallback bit
- payload.put(b); // opcode + rsv + fallback bit
- write139Size(payload,op.getNumberOfSlots());
- write139Size(payload,op.getInitialSendQuota());
- break;
- }
- }
- }
- BufferUtil.flipToFlush(payload,0);
- WebSocketFrame frame = new BinaryFrame();
- frame.setPayload(payload);
- outgoing.outgoingFrame(frame,callback);
- }
-
- public OutgoingFrames getOutgoing()
- {
- return outgoing;
- }
-
- public void setOutgoing(OutgoingFrames outgoing)
- {
- this.outgoing = outgoing;
- }
-
- /**
- * Write a 1/3/9 encoded size, then a byte buffer of that size.
- *
- * @param payload
- * @param buffer
- */
- public void write139Buffer(ByteBuffer payload, ByteBuffer buffer)
- {
- write139Size(payload,buffer.remaining());
- writeBuffer(payload,buffer);
- }
-
- /**
- * Write a 1/3/9 encoded size.
- *
- * @param payload
- * @param size
- */
- public void write139Size(ByteBuffer payload, long size)
- {
- if (size > 0xFF_FF)
- {
- // 9 byte encoded
- payload.put((byte)0x7F);
- payload.putLong(size);
- return;
- }
-
- if (size >= 0x7E)
- {
- // 3 byte encoded
- payload.put((byte)0x7E);
- payload.put((byte)(size >> 8));
- payload.put((byte)(size & 0xFF));
- return;
- }
-
- // 1 byte (7 bit) encoded
- payload.put((byte)(size & 0x7F));
- }
-
- public void writeBuffer(ByteBuffer payload, ByteBuffer buffer)
- {
- BufferUtil.put(buffer,payload);
- }
-
- /**
- * Write multiplexing channel id, using logical channel id encoding (of 1,2,3, or 4 octets)
- *
- * @param payload
- * @param channelId
- */
- public void writeChannelId(ByteBuffer payload, long channelId)
- {
- if (channelId > 0x1F_FF_FF_FF)
- {
- throw new MuxException("Illegal Channel ID: too big");
- }
-
- if (channelId > 0x1F_FF_FF)
- {
- // 29 bit channel id (4 bytes)
- payload.put((byte)(0xE0 | ((channelId >> 24) & 0x1F)));
- payload.put((byte)((channelId >> 16) & 0xFF));
- payload.put((byte)((channelId >> 8) & 0xFF));
- payload.put((byte)(channelId & 0xFF));
- return;
- }
-
- if (channelId > 0x3F_FF)
- {
- // 21 bit channel id (3 bytes)
- payload.put((byte)(0xC0 | ((channelId >> 16) & 0x1F)));
- payload.put((byte)((channelId >> 8) & 0xFF));
- payload.put((byte)(channelId & 0xFF));
- return;
- }
-
- if (channelId > 0x7F)
- {
- // 14 bit channel id (2 bytes)
- payload.put((byte)(0x80 | ((channelId >> 8) & 0x3F)));
- payload.put((byte)(channelId & 0xFF));
- return;
- }
-
- // 7 bit channel id
- payload.put((byte)(channelId & 0x7F));
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java
deleted file mode 100644
index 56361111293..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxOp.java
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-public final class MuxOp
-{
- public static final byte ADD_CHANNEL_REQUEST = 0;
- public static final byte ADD_CHANNEL_RESPONSE = 1;
- public static final byte FLOW_CONTROL = 2;
- public static final byte DROP_CHANNEL = 3;
- public static final byte NEW_CHANNEL_SLOT = 4;
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java
deleted file mode 100644
index 354783af572..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxParser.java
+++ /dev/null
@@ -1,410 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.nio.ByteBuffer;
-
-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.extensions.Frame;
-import org.eclipse.jetty.websocket.common.OpCode;
-import org.eclipse.jetty.websocket.common.WebSocketFrame;
-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
-{
- public static interface Listener
- {
- public void onMuxAddChannelRequest(MuxAddChannelRequest request);
-
- public void onMuxAddChannelResponse(MuxAddChannelResponse response);
-
- public void onMuxDropChannel(MuxDropChannel drop);
-
- public void onMuxedFrame(MuxedFrame frame);
-
- public void onMuxException(MuxException e);
-
- public void onMuxFlowControl(MuxFlowControl flow);
-
- public void onMuxNewChannelSlot(MuxNewChannelSlot slot);
- }
-
- private final static Logger LOG = Log.getLogger(MuxParser.class);
-
- private MuxedFrame muxframe = new MuxedFrame();
- private MuxParser.Listener events;
- private long channelId;
-
- public MuxParser.Listener getEvents()
- {
- return events;
- }
-
- /**
- * Parse the raw {@link WebSocketFrame} payload data for various Mux frames.
- *
- * @param frame
- * the WebSocketFrame to parse for mux payload
- */
- public synchronized void parse(Frame frame)
- {
- if (events == null)
- {
- throw new RuntimeException("No " + MuxParser.Listener.class + " specified");
- }
-
- if (!frame.hasPayload())
- {
- LOG.debug("No payload data, skipping");
- return; // nothing to parse
- }
-
- if (frame.getOpCode() != OpCode.BINARY)
- {
- LOG.debug("Not a binary opcode (base frame), skipping");
- return; // not a binary opcode
- }
-
- LOG.debug("Parsing Mux Payload of {}",frame);
-
- try
- {
- ByteBuffer buffer = frame.getPayload().slice();
-
- if (buffer.remaining() <= 0)
- {
- return;
- }
-
- if (frame.getOpCode() == OpCode.CONTINUATION)
- {
- muxframe.reset();
- muxframe.setFin(frame.isFin());
- muxframe.setFin(frame.isRsv1());
- muxframe.setFin(frame.isRsv2());
- muxframe.setFin(frame.isRsv3());
- muxframe.setIsContinuation();
- parseDataFramePayload(buffer);
- }
- else
- {
- // new frame
- channelId = readChannelId(buffer);
- if (channelId == 0)
- {
- parseControlBlocks(buffer);
- }
- else
- {
- parseDataFrame(buffer);
- }
- }
- }
- catch (MuxException e)
- {
- events.onMuxException(e);
- }
- catch (Throwable t)
- {
- events.onMuxException(new MuxException(t));
- }
- }
-
- private void parseControlBlocks(ByteBuffer buffer)
- {
- // process the remaining buffer here.
- while (buffer.remaining() > 0)
- {
- byte b = buffer.get();
- byte opc = (byte)((byte)(b >> 5) & 0xFF);
- b = (byte)(b & 0x1F);
-
- try {
- switch (opc)
- {
- case MuxOp.ADD_CHANNEL_REQUEST:
- {
- MuxAddChannelRequest op = new MuxAddChannelRequest();
- op.setRsv((byte)((b & 0x1C) >> 2));
- op.setEncoding((byte)(b & 0x03));
- op.setChannelId(readChannelId(buffer));
- long handshakeSize = read139EncodedSize(buffer);
- op.setHandshake(readBlock(buffer,handshakeSize));
- events.onMuxAddChannelRequest(op);
- break;
- }
- case MuxOp.ADD_CHANNEL_RESPONSE:
- {
- MuxAddChannelResponse op = new MuxAddChannelResponse();
- op.setFailed((b & 0x10) != 0);
- op.setRsv((byte)((byte)(b & 0x0C) >> 2));
- op.setEncoding((byte)(b & 0x03));
- op.setChannelId(readChannelId(buffer));
- long handshakeSize = read139EncodedSize(buffer);
- op.setHandshake(readBlock(buffer,handshakeSize));
- events.onMuxAddChannelResponse(op);
- break;
- }
- case MuxOp.DROP_CHANNEL:
- {
- int rsv = (b & 0x1F);
- long channelId = readChannelId(buffer);
- long reasonSize = read139EncodedSize(buffer);
- ByteBuffer reasonBuf = readBlock(buffer,reasonSize);
- MuxDropChannel op = MuxDropChannel.parse(channelId,reasonBuf);
- op.setRsv(rsv);
- events.onMuxDropChannel(op);
- break;
- }
- case MuxOp.FLOW_CONTROL:
- {
- MuxFlowControl op = new MuxFlowControl();
- op.setRsv((byte)(b & 0x1F));
- op.setChannelId(readChannelId(buffer));
- op.setSendQuotaSize(read139EncodedSize(buffer));
- events.onMuxFlowControl(op);
- break;
- }
- case MuxOp.NEW_CHANNEL_SLOT:
- {
- MuxNewChannelSlot op = new MuxNewChannelSlot();
- op.setRsv((byte)((b & 0x1E) >> 1));
- op.setFallback((b & 0x01) != 0);
- op.setNumberOfSlots(read139EncodedSize(buffer));
- op.setInitialSendQuota(read139EncodedSize(buffer));
- events.onMuxNewChannelSlot(op);
- break;
- }
- default:
- {
- String err = String.format("Unknown Mux Control Code OPC [0x%X]",opc);
- throw new MuxException(err);
- }
- }
- }
- catch (Throwable t)
- {
- LOG.warn(t);
- throw new MuxException(t);
- }
- }
- }
-
- private void parseDataFrame(ByteBuffer buffer)
- {
- byte b = buffer.get();
- boolean fin = ((b & 0x80) != 0);
- boolean rsv1 = ((b & 0x40) != 0);
- boolean rsv2 = ((b & 0x20) != 0);
- boolean rsv3 = ((b & 0x10) != 0);
- byte opcode = (byte)(b & 0x0F);
-
- if (opcode == OpCode.CONTINUATION)
- {
- muxframe.setIsContinuation();
- }
- else
- {
- muxframe.reset();
- muxframe.setOp(opcode);
- }
-
- muxframe.setChannelId(channelId);
- muxframe.setFin(fin);
- muxframe.setRsv1(rsv1);
- muxframe.setRsv2(rsv2);
- muxframe.setRsv3(rsv3);
-
- parseDataFramePayload(buffer);
- }
-
- private void parseDataFramePayload(ByteBuffer buffer)
- {
- int capacity = buffer.remaining();
- ByteBuffer payload = ByteBuffer.allocate(capacity);
- payload.put(buffer);
- BufferUtil.flipToFlush(payload,0);
- muxframe.setPayload(payload);
- try
- {
- LOG.debug("notifyFrame() - {}",muxframe);
- events.onMuxedFrame(muxframe);
- }
- catch (Throwable t)
- {
- LOG.warn(t);
- }
- }
-
- /**
- * Per section 9.1. Number Encoding in Multiplex Control
- * Blocks, read the 1/3/9 byte length using Section 5.2 of RFC 6455.
- *
- * @param buffer
- * the buffer to read from
- * @return the decoded size
- * @throws MuxException
- * when the encoding does not make sense per the spec, or it is a value above {@link Long#MAX_VALUE}
- */
- public long read139EncodedSize(ByteBuffer buffer)
- {
- long ret = -1;
- long minValue = 0x00; // used to validate minimum # of bytes (per spec)
- int cursor = 0;
-
- byte b = buffer.get();
- ret = (b & 0x7F);
-
- if (ret == 0x7F)
- {
- // 9 byte length
- ret = 0;
- minValue = 0xFF_FF;
- cursor = 8;
- }
- else if (ret == 0x7E)
- {
- // 3 byte length
- ret = 0;
- minValue = 0x7F;
- cursor = 2;
- }
- else
- {
- // 1 byte length
- // no validation of minimum bytes needed here
- return ret;
- }
-
- // parse multi-byte length
- while (cursor > 0)
- {
- ret = ret << 8;
- b = buffer.get();
- ret |= (b & 0xFF);
- --cursor;
- }
-
- // validate minimum value per spec.
- if (ret <= minValue)
- {
- String err = String.format("Invalid 1/3/9 length 0x%X (minimum value for chosen encoding is 0x%X)",ret,minValue);
- throw new MuxException(err);
- }
-
- return ret;
- }
-
- private ByteBuffer readBlock(ByteBuffer buffer, long size)
- {
- if (size == 0)
- {
- return null;
- }
-
- if (size > buffer.remaining())
- {
- String err = String.format("Truncated data, expected %,d byte(s), but only %,d byte(s) remain",size,buffer.remaining());
- throw new MuxException(err);
- }
-
- if (size > Integer.MAX_VALUE)
- {
- String err = String.format("[Int-Sane!] Buffer size %,d is too large to be supported (max allowed is %,d)",size,Integer.MAX_VALUE);
- throw new MuxException(err);
- }
-
- ByteBuffer ret = ByteBuffer.allocate((int)size);
- BufferUtil.put(buffer,ret);
- BufferUtil.flipToFlush(ret,0);
- return ret;
- }
-
- /**
- * Read Channel ID using Section 7. Framing techniques
- *
- * @param buffer
- * the buffer to parse from.
- * @return the channel Id
- * @throws MuxException
- * when the encoding does not make sense per the spec.
- */
- public long readChannelId(ByteBuffer buffer)
- {
- long id = -1;
- long minValue = 0x00; // used to validate minimum # of bytes (per spec)
- byte b = buffer.get();
- int cursor = -1;
- if ((b & 0x80) == 0)
- {
- // 7 bit channel id
- // no validation of minimum bytes needed here
- return (b & 0x7F);
- }
- else if ((b & 0x40) == 0)
- {
- // 14 bit channel id
- id = (b & 0x3F);
- minValue = 0x7F;
- cursor = 1;
- }
- else if ((b & 0x20) == 0)
- {
- // 21 bit channel id
- id = (b & 0x1F);
- minValue = 0x3F_FF;
- cursor = 2;
- }
- else
- {
- // 29 bit channel id
- id = (b & 0x1F);
- minValue = 0x1F_FF_FF;
- cursor = 3;
- }
-
- while (cursor > 0)
- {
- id = id << 8;
- b = buffer.get();
- id |= (b & 0xFF);
- --cursor;
- }
-
- // validate minimum value per spec.
- if (id <= minValue)
- {
- String err = String.format("Invalid Channel ID 0x%X (minimum value for chosen encoding is 0x%X)",id,minValue);
- throw new MuxException(err);
- }
-
- return id;
- }
-
- public void setEvents(MuxParser.Listener events)
- {
- this.events = events;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java
deleted file mode 100644
index a32e412b7a7..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxPhysicalConnectionException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.mux.op.MuxDropChannel;
-
-public class MuxPhysicalConnectionException extends MuxException
-{
- private static final long serialVersionUID = 1L;
- private MuxDropChannel drop;
-
- public MuxPhysicalConnectionException(MuxDropChannel.Reason code, String phrase)
- {
- super(phrase);
- drop = new MuxDropChannel(0,code,phrase);
- }
-
- public MuxPhysicalConnectionException(MuxDropChannel.Reason code, String phrase, Throwable t)
- {
- super(phrase,t);
- drop = new MuxDropChannel(0,code,phrase);
- }
-
- public MuxDropChannel getMuxDropChannel()
- {
- return drop;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java
deleted file mode 100644
index bb205646926..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jetty.websocket.api.UpgradeRequest;
-
-public class MuxRequest extends UpgradeRequest
-{
- public static final String HEADER_VALUE_DELIM="\"\\\n\r\t\f\b%+ ;=";
-
- public static UpgradeRequest merge(UpgradeRequest baseReq, UpgradeRequest deltaReq)
- {
- MuxRequest req = new MuxRequest(baseReq);
-
- // TODO: finish
-
- return req;
- }
-
- private static String overlay(String val, String defVal)
- {
- if (val == null)
- {
- return defVal;
- }
- return val;
- }
-
- public static UpgradeRequest parse(ByteBuffer handshake)
- {
- MuxRequest req = new MuxRequest();
- // TODO Auto-generated method stub
- return req;
- }
-
- public MuxRequest()
- {
- super();
- }
-
- public MuxRequest(UpgradeRequest copy)
- {
- super();
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java
deleted file mode 100644
index fa6912a5504..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxResponse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.api.UpgradeResponse;
-
-public class MuxResponse extends UpgradeResponse
-{
-
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java
deleted file mode 100644
index 95f2d4e81ad..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/MuxedFrame.java
+++ /dev/null
@@ -1,78 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.common.OpCode;
-import org.eclipse.jetty.websocket.common.frames.DataFrame;
-
-public class MuxedFrame extends DataFrame
-{
- private long channelId = -1;
-
- public MuxedFrame()
- {
- super(OpCode.BINARY);
- }
-
- public MuxedFrame(MuxedFrame frame)
- {
- super(frame);
- this.channelId = frame.channelId;
- }
-
- public long getChannelId()
- {
- return channelId;
- }
-
- @Override
- public void reset()
- {
- super.reset();
- this.channelId = -1;
- }
-
- public void setChannelId(long channelId)
- {
- this.channelId = channelId;
- }
-
- @Override
- public String toString()
- {
- StringBuilder b = new StringBuilder();
- b.append(OpCode.name(getOpCode()));
- b.append('[');
- b.append("channel=").append(channelId);
- b.append(",len=").append(getPayloadLength());
- b.append(",fin=").append(isFin());
- b.append(",rsv=");
- b.append(isRsv1()?'1':'.');
- b.append(isRsv2()?'1':'.');
- b.append(isRsv3()?'1':'.');
- b.append(']');
- return b.toString();
- }
-
- public void setOp(byte opcode)
- {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java
deleted file mode 100644
index 28093cba756..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/Muxer.java
+++ /dev/null
@@ -1,439 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jetty.util.StringUtil;
-import org.eclipse.jetty.util.log.Log;
-import org.eclipse.jetty.util.log.Logger;
-import org.eclipse.jetty.websocket.api.StatusCode;
-import org.eclipse.jetty.websocket.api.UpgradeRequest;
-import org.eclipse.jetty.websocket.api.UpgradeResponse;
-import org.eclipse.jetty.websocket.api.WebSocketBehavior;
-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.api.extensions.OutgoingFrames;
-import org.eclipse.jetty.websocket.common.LogicalConnection;
-import org.eclipse.jetty.websocket.common.frames.ControlFrame;
-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.
- *
- * Maintains a 1 (incoming and outgoing mux encapsulated frames) to many (per-channel incoming/outgoing standard websocket frames) relationship, along with
- * routing of {@link MuxControlBlock} events.
- *
- * Control Channel events (channel ID == 0) are handled by the Muxer.
- */
-public class Muxer implements IncomingFrames, MuxParser.Listener
-{
- private static final int CONTROL_CHANNEL_ID = 0;
-
- private static final Logger LOG = Log.getLogger(Muxer.class);
-
- /**
- * Map of sub-channels, key is the channel Id.
- */
- private Map channels = new HashMap();
-
- private final WebSocketPolicy policy;
- private final LogicalConnection physicalConnection;
- private InetSocketAddress remoteAddress;
- /** Parsing frames destined for sub-channels */
- private MuxParser parser;
- /** Generating frames destined for physical connection */
- private MuxGenerator generator;
- private MuxAddServer addServer;
- private MuxAddClient addClient;
- /** The original request headers, used for delta encoded AddChannelRequest blocks */
- private UpgradeRequest physicalRequestHeaders;
- /** The original response headers, used for delta encoded AddChannelResponse blocks */
- private UpgradeResponse physicalResponseHeaders;
-
- public Muxer(final LogicalConnection connection)
- {
- this.physicalConnection = connection;
- this.policy = connection.getPolicy().clonePolicy();
- this.parser = new MuxParser();
- this.parser.setEvents(this);
- this.generator = new MuxGenerator();
- }
-
- public MuxAddClient getAddClient()
- {
- return addClient;
- }
-
- public MuxAddServer getAddServer()
- {
- return addServer;
- }
-
- public MuxChannel getChannel(long channelId, boolean create)
- {
- if (channelId == CONTROL_CHANNEL_ID)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Invalid Channel ID");
- }
-
- MuxChannel channel = channels.get(channelId);
- if (channel == null)
- {
- if (create)
- {
- channel = new MuxChannel(channelId,this);
- channels.put(channelId,channel);
- }
- else
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Unknown Channel ID");
- }
- }
- return channel;
- }
-
- public WebSocketPolicy getPolicy()
- {
- return policy;
- }
-
- /**
- * Get the remote address of the physical connection.
- *
- * @return the remote address of the physical connection
- */
- public InetSocketAddress getRemoteAddress()
- {
- return this.remoteAddress;
- }
-
- /**
- * Incoming parser errors
- */
- @Override
- public void incomingError(Throwable e)
- {
- MuxDropChannel.Reason reason = MuxDropChannel.Reason.PHYSICAL_CONNECTION_FAILED;
- String phrase = String.format("%s: %s", e.getClass().getName(), e.getMessage());
- mustFailPhysicalConnection(new MuxPhysicalConnectionException(reason,phrase));
- }
-
- /**
- * Incoming mux encapsulated frames.
- */
- @Override
- public void incomingFrame(Frame frame)
- {
- parser.parse(frame);
- }
-
- /**
- * Is the muxer and the physical connection still open?
- *
- * @return true if open
- */
- public boolean isOpen()
- {
- return physicalConnection.isOpen();
- }
-
- public String mergeHeaders(List physicalHeaders, String deltaHeaders)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Per spec, the physical connection must be failed.
- *
To _Fail the Physical Connection_, an endpoint MUST send a DropChannel multiplex control block with objective channel ID of 0 and drop
- * reason code in the range of 2000-2999, and then _Fail the WebSocket Connection_ on the physical connection with status code of 1011.
- */
- private void mustFailPhysicalConnection(MuxPhysicalConnectionException muxe)
- {
- // TODO: stop muxer from receiving incoming sub-channel traffic.
-
- MuxDropChannel drop = muxe.getMuxDropChannel();
- LOG.warn(muxe);
- try
- {
- generator.generate(null,drop);
- }
- catch (IOException ioe)
- {
- LOG.warn("Unable to send mux DropChannel",ioe);
- }
-
- String reason = "Mux[MUST FAIL]" + drop.getPhrase();
- reason = StringUtil.truncate(reason,ControlFrame.MAX_CONTROL_PAYLOAD);
- this.physicalConnection.close(StatusCode.SERVER_ERROR,reason);
-
- // TODO: trigger abnormal close for all sub-channels.
- }
-
- /**
- * Incoming mux control block, destined for the control channel (id 0)
- */
- @Override
- public void onMuxAddChannelRequest(MuxAddChannelRequest request)
- {
- if (policy.getBehavior() == WebSocketBehavior.CLIENT)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"AddChannelRequest not allowed per spec");
- }
-
- if (request.getRsv() != 0)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_REQUEST_ENCODING,"RSV Not allowed to be set");
- }
-
- // Pre-allocate channel.
- long channelId = request.getChannelId();
- MuxChannel channel = getChannel(channelId, true);
-
- // submit to upgrade handshake process
- try
- {
- switch (request.getEncoding())
- {
- case MuxAddChannelRequest.IDENTITY_ENCODING:
- {
- UpgradeRequest idenReq = MuxRequest.parse(request.getHandshake());
- addServer.handshake(this,channel,idenReq);
- break;
- }
- case MuxAddChannelRequest.DELTA_ENCODING:
- {
- UpgradeRequest baseReq = addServer.getPhysicalHandshakeRequest();
- UpgradeRequest deltaReq = MuxRequest.parse(request.getHandshake());
- UpgradeRequest mergedReq = MuxRequest.merge(baseReq,deltaReq);
-
- addServer.handshake(this,channel,mergedReq);
- break;
- }
- default:
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.BAD_REQUEST,"Unrecognized request encoding");
- }
- }
- }
- catch (MuxPhysicalConnectionException e)
- {
- throw e;
- }
- catch (Throwable t)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.BAD_REQUEST,"Unable to parse request",t);
- }
- }
-
- /**
- * Incoming mux control block, destined for the control channel (id 0)
- */
- @Override
- public void onMuxAddChannelResponse(MuxAddChannelResponse response)
- {
- if (policy.getBehavior() == WebSocketBehavior.SERVER)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"AddChannelResponse not allowed per spec");
- }
-
- if (response.getRsv() != 0)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_RESPONSE_ENCODING,"RSV Not allowed to be set");
- }
-
- // Process channel
- long channelId = response.getChannelId();
- MuxChannel channel = getChannel(channelId,false);
-
- // Process Response headers
- try
- {
- // Parse Response
-
- // TODO: Sec-WebSocket-Accept header
- // TODO: Sec-WebSocket-Extensions header
- // TODO: Setup extensions
- // TODO: Setup sessions
-
- // Trigger channel open
- channel.onOpen();
- }
- catch (Throwable t)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.BAD_RESPONSE,"Unable to parse response",t);
- }
- }
-
- /**
- * Incoming mux control block, destined for the control channel (id 0)
- */
- @Override
- public void onMuxDropChannel(MuxDropChannel drop)
- {
- // Process channel
- long channelId = drop.getChannelId();
- MuxChannel channel = getChannel(channelId,false);
-
- String reason = "Mux " + drop.toString();
- reason = StringUtil.truncate(reason,(ControlFrame.MAX_CONTROL_PAYLOAD - 2));
- channel.close(StatusCode.PROTOCOL,reason);
- // TODO: set channel to inactive?
- }
-
- /**
- * Incoming mux-unwrapped frames, destined for a sub-channel
- */
- @Override
- public void onMuxedFrame(MuxedFrame frame)
- {
- MuxChannel subchannel = channels.get(frame.getChannelId());
- subchannel.incomingFrame(frame);
- }
-
- @Override
- public void onMuxException(MuxException e)
- {
- if (e instanceof MuxPhysicalConnectionException)
- {
- mustFailPhysicalConnection((MuxPhysicalConnectionException)e);
- }
-
- LOG.warn(e);
- // TODO: handle other (non physical) mux exceptions how?
- }
-
- /**
- * Incoming mux control block, destined for the control channel (id 0)
- */
- @Override
- public void onMuxFlowControl(MuxFlowControl flow)
- {
- if (flow.getSendQuotaSize() > 0x7F_FF_FF_FF_FF_FF_FF_FFL)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.SEND_QUOTA_OVERFLOW,"Send Quota Overflow");
- }
-
- // Process channel
- long channelId = flow.getChannelId();
- MuxChannel channel = getChannel(channelId,false);
-
- // TODO: set channel quota
- }
-
- /**
- * Incoming mux control block, destined for the control channel (id 0)
- */
- @Override
- public void onMuxNewChannelSlot(MuxNewChannelSlot slot)
- {
- if (policy.getBehavior() == WebSocketBehavior.SERVER)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"NewChannelSlot not allowed per spec");
- }
-
- if (slot.isFallback())
- {
- if (slot.getNumberOfSlots() == 0)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Cannot have 0 number of slots during fallback");
- }
- if (slot.getInitialSendQuota() == 0)
- {
- throw new MuxPhysicalConnectionException(MuxDropChannel.Reason.UNKNOWN_MUX_CONTROL_BLOCK,"Cannot have 0 initial send quota during fallback");
- }
- }
-
- // TODO: handle channel slot
- }
-
- /**
- * Outgoing frame, without mux encapsulated payload.
- */
- public void output(long channelId, Frame frame, WriteCallback callback)
- {
- if (LOG.isDebugEnabled())
- {
- LOG.debug("output({}, {})",channelId,frame,callback);
- }
- generator.generate(channelId,frame,callback);
- }
-
- /**
- * Write an OP out the physical connection.
- *
- * @param op
- * the mux operation to write
- * @throws IOException
- */
- public void output(MuxControlBlock op) throws IOException
- {
- generator.generate(null,op);
- }
-
- public void setAddClient(MuxAddClient addClient)
- {
- this.addClient = addClient;
- }
-
- public void setAddServer(MuxAddServer addServer)
- {
- this.addServer = addServer;
- }
-
- public void setOutgoingFramesHandler(OutgoingFrames outgoing)
- {
- this.generator.setOutgoing(outgoing);
- }
-
- /**
- * Set the remote address of the physical connection.
- *
- * This address made available to sub-channels.
- *
- * @param remoteAddress
- * the remote address
- */
- public void setRemoteAddress(InetSocketAddress remoteAddress)
- {
- this.remoteAddress = remoteAddress;
- }
-
- @Override
- public String toString()
- {
- return String.format("Muxer[subChannels.size=%d]",channels.size());
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java
deleted file mode 100644
index 098b7e94f13..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddClient.java
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.add;
-
-import org.eclipse.jetty.websocket.common.WebSocketSession;
-import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse;
-
-/**
- * Interface for Mux Client to handle receiving a AddChannelResponse
- */
-public interface MuxAddClient
-{
- WebSocketSession createSession(MuxAddChannelResponse response);
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java
deleted file mode 100644
index 20164b65abd..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/MuxAddServer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.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.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.
- */
-public interface MuxAddServer
-{
- public UpgradeRequest getPhysicalHandshakeRequest();
-
- public UpgradeResponse getPhysicalHandshakeResponse();
-
- /**
- * Perform the handshake.
- *
- * @param channel
- * the channel to attach the {@link WebSocketSession} to.
- * @param requestHandshake
- * the request handshake (request headers)
- * @throws MuxException
- * if unable to handshake
- * @throws IOException
- * if unable to parse request headers
- */
- void handshake(Muxer muxer, MuxChannel channel, UpgradeRequest request) throws MuxException, IOException;
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java
deleted file mode 100644
index 0b8f1e11d1a..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/add/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.
-// ========================================================================
-//
-
-/**
- * Jetty WebSocket Common : MUX Extension Add Channel Handling [Unstable Early Draft]
- */
-package org.eclipse.jetty.websocket.mux.add;
-
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java
deleted file mode 100644
index d412d47598c..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientAddHandler.java
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.client;
-
-import org.eclipse.jetty.websocket.common.WebSocketSession;
-import org.eclipse.jetty.websocket.mux.add.MuxAddClient;
-import org.eclipse.jetty.websocket.mux.op.MuxAddChannelResponse;
-
-public class MuxClientAddHandler implements MuxAddClient
-{
- @Override
- public WebSocketSession createSession(MuxAddChannelResponse response)
- {
- // TODO Auto-generated method stub
- return null;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java
deleted file mode 100644
index 1d97dfaa9af..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/MuxClientExtension.java
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.client;
-
-import org.eclipse.jetty.websocket.mux.AbstractMuxExtension;
-import org.eclipse.jetty.websocket.mux.Muxer;
-
-public class MuxClientExtension extends AbstractMuxExtension
-{
- @Override
- public void configureMuxer(Muxer muxer)
- {
- muxer.setAddClient(new MuxClientAddHandler());
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java
deleted file mode 100644
index 15c75257021..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/client/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.
-// ========================================================================
-//
-
-/**
- * Jetty WebSocket Client : MUX Extension [Unstable Early Draft]
- */
-package org.eclipse.jetty.websocket.mux.client;
-
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java
deleted file mode 100644
index 87dcd953163..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelRequest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.op;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-
-import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.websocket.mux.MuxControlBlock;
-import org.eclipse.jetty.websocket.mux.MuxOp;
-
-public class MuxAddChannelRequest implements MuxControlBlock
-{
- public static final byte IDENTITY_ENCODING = (byte)0x00;
- public static final byte DELTA_ENCODING = (byte)0x01;
-
- private long channelId = -1;
- private byte encoding;
- private ByteBuffer handshake;
- private byte rsv;
-
- public long getChannelId()
- {
- return channelId;
- }
-
- public byte getEncoding()
- {
- return encoding;
- }
-
- public ByteBuffer getHandshake()
- {
- return handshake;
- }
-
- public long getHandshakeSize()
- {
- if (handshake == null)
- {
- return 0;
- }
- return handshake.remaining();
- }
-
- @Override
- public int getOpCode()
- {
- return MuxOp.ADD_CHANNEL_REQUEST;
- }
-
- public byte getRsv()
- {
- return rsv;
- }
-
- public boolean isDeltaEncoded()
- {
- return (encoding == DELTA_ENCODING);
- }
-
- public boolean isIdentityEncoded()
- {
- return (encoding == IDENTITY_ENCODING);
- }
-
- public void setChannelId(long channelId)
- {
- this.channelId = channelId;
- }
-
- public void setEncoding(byte enc)
- {
- this.encoding = enc;
- }
-
- public void setHandshake(ByteBuffer handshake)
- {
- if (handshake == null)
- {
- this.handshake = null;
- }
- else
- {
- this.handshake = handshake.slice();
- }
- }
-
- public void setHandshake(String rawstring)
- {
- setHandshake(BufferUtil.toBuffer(rawstring, StandardCharsets.UTF_8));
- }
-
- public void setRsv(byte rsv)
- {
- this.rsv = rsv;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java
deleted file mode 100644
index ea7b94fb907..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxAddChannelResponse.java
+++ /dev/null
@@ -1,125 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.op;
-
-import java.nio.ByteBuffer;
-import java.nio.charset.StandardCharsets;
-
-import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.websocket.mux.MuxControlBlock;
-import org.eclipse.jetty.websocket.mux.MuxOp;
-
-public class MuxAddChannelResponse implements MuxControlBlock
-{
- public static final byte IDENTITY_ENCODING = (byte)0x00;
- public static final byte DELTA_ENCODING = (byte)0x01;
-
- private long channelId;
- private byte encoding;
- private byte rsv;
- private boolean failed = false;
- private ByteBuffer handshake;
-
- public long getChannelId()
- {
- return channelId;
- }
-
- public byte getEncoding()
- {
- return encoding;
- }
-
- public ByteBuffer getHandshake()
- {
- return handshake;
- }
-
- public long getHandshakeSize()
- {
- if (handshake == null)
- {
- return 0;
- }
- return handshake.remaining();
- }
-
- @Override
- public int getOpCode()
- {
- return MuxOp.ADD_CHANNEL_RESPONSE;
- }
-
- public byte getRsv()
- {
- return rsv;
- }
-
- public boolean isDeltaEncoded()
- {
- return (encoding == DELTA_ENCODING);
- }
-
- public boolean isFailed()
- {
- return failed;
- }
-
- public boolean isIdentityEncoded()
- {
- return (encoding == IDENTITY_ENCODING);
- }
-
- public void setChannelId(long channelId)
- {
- this.channelId = channelId;
- }
-
- public void setEncoding(byte enc)
- {
- this.encoding = enc;
- }
-
- public void setFailed(boolean failed)
- {
- this.failed = failed;
- }
-
- public void setHandshake(ByteBuffer handshake)
- {
- if (handshake == null)
- {
- this.handshake = null;
- }
- else
- {
- this.handshake = handshake.slice();
- }
- }
-
- public void setHandshake(String responseHandshake)
- {
- setHandshake(BufferUtil.toBuffer(responseHandshake, StandardCharsets.UTF_8));
- }
-
- public void setRsv(byte rsv)
- {
- this.rsv = rsv;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java
deleted file mode 100644
index 71aa58ffdc6..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxDropChannel.java
+++ /dev/null
@@ -1,183 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.op;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jetty.websocket.mux.MuxControlBlock;
-import org.eclipse.jetty.websocket.mux.MuxOp;
-
-public class MuxDropChannel implements MuxControlBlock
-{
- /**
- * Outlined in Section 9.4.1. Drop Reason Codes
- */
- public static enum Reason
- {
- // Normal Close : (1000-1999)
- NORMAL_CLOSURE(1000),
-
- // Failures in Physical Connection : (2000-2999)
- PHYSICAL_CONNECTION_FAILED(2000),
- INVALID_ENCAPSULATING_MESSAGE(2001),
- CHANNEL_ID_TRUNCATED(2002),
- ENCAPSULATED_FRAME_TRUNCATED(2003),
- UNKNOWN_MUX_CONTROL_OPC(2004),
- UNKNOWN_MUX_CONTROL_BLOCK(2005),
- CHANNEL_ALREADY_EXISTS(2006),
- NEW_CHANNEL_SLOT_VIOLATION(2007),
- NEW_CHANNEL_SLOT_OVERFLOW(2008),
- BAD_REQUEST(2009),
- UNKNOWN_REQUEST_ENCODING(2010),
- BAD_RESPONSE(2011),
- UNKNOWN_RESPONSE_ENCODING(2012),
-
- // Failures in Logical Connections : (3000-3999)
- LOGICAL_CHANNEL_FAILED(3000),
- SEND_QUOTA_VIOLATION(3005),
- SEND_QUOTA_OVERFLOW(3006),
- IDLE_TIMEOUT(3007),
- DROP_CHANNEL_ACK(3008),
-
- // Other Peer Actions : (4000-4999)
- USE_ANOTHER_PHYSICAL_CONNECTION(4001),
- BUSY(4002);
-
- private static final Map codeMap;
-
- static
- {
- codeMap = new HashMap<>();
- for (Reason r : values())
- {
- codeMap.put(r.getValue(),r);
- }
- }
-
- public static Reason valueOf(int code)
- {
- return codeMap.get(code);
- }
-
- private final int code;
-
- private Reason(int code)
- {
- this.code = code;
- }
-
- public int getValue()
- {
- return code;
- }
- }
-
- public static MuxDropChannel parse(long channelId, ByteBuffer payload)
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- private final long channelId;
- private final Reason code;
- private String phrase;
- private int rsv;
-
- /**
- * Normal Drop. no reason Phrase.
- *
- * @param channelId
- * the logical channel Id to perform drop against.
- */
- public MuxDropChannel(long channelId)
- {
- this(channelId,Reason.NORMAL_CLOSURE,null);
- }
-
- /**
- * Drop with reason code and optional phrase
- *
- * @param channelId
- * the logical channel Id to perform drop against.
- * @param code
- * reason code
- * @param phrase
- * optional human readable phrase
- */
- public MuxDropChannel(long channelId, int code, String phrase)
- {
- this(channelId, Reason.valueOf(code), phrase);
- }
-
- /**
- * Drop with reason code and optional phrase
- *
- * @param channelId
- * the logical channel Id to perform drop against.
- * @param code
- * reason code
- * @param phrase
- * optional human readable phrase
- */
- public MuxDropChannel(long channelId, Reason code, String phrase)
- {
- this.channelId = channelId;
- this.code = code;
- this.phrase = phrase;
- }
-
- public ByteBuffer asReasonBuffer()
- {
- // TODO: convert to reason buffer
- return null;
- }
-
- public long getChannelId()
- {
- return channelId;
- }
-
- public Reason getCode()
- {
- return code;
- }
-
- @Override
- public int getOpCode()
- {
- return MuxOp.DROP_CHANNEL;
- }
-
- public String getPhrase()
- {
- return phrase;
- }
-
- public int getRsv()
- {
- return rsv;
- }
-
- public void setRsv(int rsv)
- {
- this.rsv = rsv;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java
deleted file mode 100644
index aabce059454..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxFlowControl.java
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.op;
-
-import org.eclipse.jetty.websocket.mux.MuxControlBlock;
-import org.eclipse.jetty.websocket.mux.MuxOp;
-
-public class MuxFlowControl implements MuxControlBlock
-{
- private long channelId;
- private byte rsv;
- private long sendQuotaSize;
-
- public long getChannelId()
- {
- return channelId;
- }
-
- @Override
- public int getOpCode()
- {
- return MuxOp.FLOW_CONTROL;
- }
-
- public byte getRsv()
- {
- return rsv;
- }
-
- public long getSendQuotaSize()
- {
- return sendQuotaSize;
- }
-
- public void setChannelId(long channelId)
- {
- this.channelId = channelId;
- }
-
- public void setRsv(byte rsv)
- {
- this.rsv = rsv;
- }
-
- public void setSendQuotaSize(long sendQuotaSize)
- {
- this.sendQuotaSize = sendQuotaSize;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java
deleted file mode 100644
index d7a41facb2f..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/MuxNewChannelSlot.java
+++ /dev/null
@@ -1,76 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.op;
-
-import org.eclipse.jetty.websocket.mux.MuxControlBlock;
-import org.eclipse.jetty.websocket.mux.MuxOp;
-
-public class MuxNewChannelSlot implements MuxControlBlock
-{
- private boolean fallback;
- private long initialSendQuota;
- private long numberOfSlots;
- private byte rsv;
-
- public long getInitialSendQuota()
- {
- return initialSendQuota;
- }
-
- public long getNumberOfSlots()
- {
- return numberOfSlots;
- }
-
- @Override
- public int getOpCode()
- {
- return MuxOp.NEW_CHANNEL_SLOT;
- }
-
- public byte getRsv()
- {
- return rsv;
- }
-
- public boolean isFallback()
- {
- return fallback;
- }
-
- public void setFallback(boolean fallback)
- {
- this.fallback = fallback;
- }
-
- public void setInitialSendQuota(long initialSendQuota)
- {
- this.initialSendQuota = initialSendQuota;
- }
-
- public void setNumberOfSlots(long numberOfSlots)
- {
- this.numberOfSlots = numberOfSlots;
- }
-
- public void setRsv(byte rsv)
- {
- this.rsv = rsv;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java
deleted file mode 100644
index 0500321b185..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/op/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.
-// ========================================================================
-//
-
-/**
- * Jetty WebSocket Common : MUX Extension OpCode Handling [Unstable Early Draft]
- */
-package org.eclipse.jetty.websocket.mux.op;
-
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java
deleted file mode 100644
index dc409bfc4cc..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.
-// ========================================================================
-//
-
-/**
- * Jetty WebSocket Common : MUX Extension Core [Unstable Early Draft]
- */
-package org.eclipse.jetty.websocket.mux;
-
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java
deleted file mode 100644
index 6ff70318d7c..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/EmptyHttpInput.java
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.server;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jetty.server.ByteBufferQueuedHttpInput;
-
-/**
- * HttpInput for Empty Http body sections.
- */
-public class EmptyHttpInput extends ByteBufferQueuedHttpInput
-{
- @Override
- protected int get(ByteBuffer item, byte[] buffer, int offset, int length)
- {
- return 0;
- }
-
- @Override
- protected int remaining(ByteBuffer item)
- {
- return 0;
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java
deleted file mode 100644
index 3c03ac106e6..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpChannelOverMux.java
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.server;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jetty.io.EndPoint;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpChannel;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpInput;
-import org.eclipse.jetty.server.HttpTransport;
-
-/**
- * Process incoming AddChannelRequest headers within the existing Jetty framework. Benefiting from Server container knowledge and various webapp configuration
- * knowledge.
- */
-public class HttpChannelOverMux extends HttpChannel
-{
- public HttpChannelOverMux(Connector connector, HttpConfiguration configuration, EndPoint endPoint, HttpTransport transport, HttpInput input)
- {
- super(connector,configuration,endPoint,transport,input);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java
deleted file mode 100644
index 7bdf657311b..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/HttpTransportOverMux.java
+++ /dev/null
@@ -1,74 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.server;
-
-import java.nio.ByteBuffer;
-
-import org.eclipse.jetty.http.HttpGenerator.ResponseInfo;
-import org.eclipse.jetty.server.HttpTransport;
-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.mux.MuxChannel;
-import org.eclipse.jetty.websocket.mux.Muxer;
-
-/**
- * Take {@link ResponseInfo} objects and convert to bytes for response.
- */
-public class HttpTransportOverMux implements HttpTransport
-{
- private static final Logger LOG = Log.getLogger(HttpTransportOverMux.class);
- private final BlockingCallback streamBlocker = new BlockingCallback();
-
- public HttpTransportOverMux(Muxer muxer, MuxChannel channel)
- {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void completed()
- {
- LOG.debug("completed");
- }
-
-
- @Override
- public void send(ResponseInfo info, ByteBuffer responseBodyContent, boolean lastContent, Callback callback)
- {
- if (lastContent == false)
- {
- // throw error
- }
-
- if (info.getContentLength() > 0)
- {
- // throw error
- }
-
- // prepare the AddChannelResponse
- // TODO: look at HttpSender in jetty-client for generator loop logic
- }
-
- @Override
- public void send(ByteBuffer responseBodyContent, boolean lastContent, Callback callback)
- {
- send(null,responseBodyContent, lastContent, callback);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java
deleted file mode 100644
index d058a215806..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxAddHandler.java
+++ /dev/null
@@ -1,112 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.server;
-
-import java.io.IOException;
-
-import org.eclipse.jetty.http.HttpField;
-import org.eclipse.jetty.http.HttpHeader;
-import org.eclipse.jetty.http.HttpMethod;
-import org.eclipse.jetty.http.HttpVersion;
-import org.eclipse.jetty.io.EndPoint;
-import org.eclipse.jetty.server.Connector;
-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.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.
- */
-public class MuxAddHandler implements MuxAddServer
-{
- /** Represents physical connector */
- private Connector connector;
-
- /** Used for local address */
- private EndPoint endPoint;
-
- /** The original request handshake */
- private UpgradeRequest baseHandshakeRequest;
-
- /** The original request handshake */
- private UpgradeResponse baseHandshakeResponse;
-
- private int maximumHeaderSize = 32 * 1024;
-
- @Override
- public UpgradeRequest getPhysicalHandshakeRequest()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public UpgradeResponse getPhysicalHandshakeResponse()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * An incoming MuxAddChannel request.
- *
- * @param muxer the muxer handling this
- * @param channel the
- * channel this request should be bound to
- * @param request
- * the incoming request headers (complete and merged if delta encoded)
- */
- @Override
- public void handshake(Muxer muxer, MuxChannel channel, UpgradeRequest request) throws MuxException, IOException
- {
- // Need to call into HttpChannel to get the websocket properly setup.
- HttpTransportOverMux transport = new HttpTransportOverMux(muxer,channel);
- EmptyHttpInput input = new EmptyHttpInput();
- HttpConfiguration configuration = new HttpConfiguration();
-
- HttpChannelOverMux httpChannel = new HttpChannelOverMux(//
- connector,configuration,endPoint,transport,input);
-
- HttpMethod method = HttpMethod.fromString(request.getMethod());
- HttpVersion version = HttpVersion.fromString(request.getHttpVersion());
- httpChannel.startRequest(method,request.getMethod(),BufferUtil.toBuffer(request.getRequestURI().toASCIIString()),version);
-
- for (String headerName : request.getHeaders().keySet())
- {
- HttpHeader header = HttpHeader.CACHE.getBest(headerName.getBytes(),0,headerName.length());
- for (String value : request.getHeaders().get(headerName))
- {
- httpChannel.parsedHeader(new HttpField(header,value));
- }
- }
-
- httpChannel.headerComplete();
- httpChannel.messageComplete();
- httpChannel.run(); // calls into server for appropriate resource
-
- // TODO: what's in request handshake is not enough to process the request.
- // like a partial http request. (consider this a AddChannelRequest failure)
- throw new MuxException("Not a valid request");
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java
deleted file mode 100644
index 635e0a298ed..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/MuxServerExtension.java
+++ /dev/null
@@ -1,31 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.server;
-
-import org.eclipse.jetty.websocket.mux.AbstractMuxExtension;
-import org.eclipse.jetty.websocket.mux.Muxer;
-
-public class MuxServerExtension extends AbstractMuxExtension
-{
- @Override
- public void configureMuxer(Muxer muxer)
- {
- muxer.setAddServer(new MuxAddHandler());
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java b/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java
deleted file mode 100644
index b5785ac8381..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/java/org/eclipse/jetty/websocket/mux/server/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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.
-// ========================================================================
-//
-
-/**
- * Jetty WebSocket Server : MUX Extension [Unstable Early Draft]
- */
-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
deleted file mode 100644
index 8c39ac74fd2..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.client.ClientExtension
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 05c99741af7..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/main/resources/META-INF/services/org.eclipse.jetty.websocket.server.ServerExtension
+++ /dev/null
@@ -1 +0,0 @@
-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
deleted file mode 100644
index 5c4a4fe6c92..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/test/java/examples/echo/AdapterEchoSocket.java
+++ /dev/null
@@ -1,47 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java
deleted file mode 100644
index f5f90a44ff1..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxDecoder.java
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import org.eclipse.jetty.websocket.api.WriteCallback;
-import org.eclipse.jetty.websocket.api.extensions.Frame;
-import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
-
-/**
- * Helpful utility class to parse arbitrary mux events from a physical connection's OutgoingFrames.
- *
- * @see MuxEncoder
- */
-public class MuxDecoder extends MuxEventCapture implements OutgoingFrames
-{
- private MuxParser parser;
-
- public MuxDecoder()
- {
- parser = new MuxParser();
- parser.setEvents(this);
- }
-
- @Override
- public void outgoingFrame(Frame frame, WriteCallback callback)
- {
- parser.parse(frame);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java
deleted file mode 100644
index 9e5699e4ae3..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEncoder.java
+++ /dev/null
@@ -1,64 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import java.io.IOException;
-
-import org.eclipse.jetty.websocket.api.WriteCallback;
-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;
-
-/**
- * Helpful utility class to send arbitrary mux events into a physical connection's IncomingFrames.
- *
- * @see MuxDecoder
- */
-public class MuxEncoder
-{
- public static MuxEncoder toIncoming(IncomingFrames incoming)
- {
- return new MuxEncoder(FramePipes.to(incoming));
- }
-
- public static MuxEncoder toOutgoing(OutgoingFrames outgoing)
- {
- return new MuxEncoder(outgoing);
- }
-
- private MuxGenerator generator;
-
- private MuxEncoder(OutgoingFrames outgoing)
- {
- this.generator = new MuxGenerator();
- this.generator.setOutgoing(outgoing);
- }
-
- public void frame(long channelId, WebSocketFrame frame) throws IOException
- {
- this.generator.generate(channelId,frame,null);
- }
-
- public void op(MuxControlBlock op) throws IOException
- {
- WriteCallback callback = null;
- this.generator.generate(callback,op);
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java
deleted file mode 100644
index 1f7aa4266a5..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxEventCapture.java
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import static org.hamcrest.Matchers.is;
-
-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.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
-{
- private static final Logger LOG = Log.getLogger(MuxEventCapture.class);
-
- private LinkedList frames = new LinkedList<>();
- private LinkedList ops = new LinkedList<>();
- private LinkedList errors = new LinkedList<>();
-
- public void assertFrameCount(int expected)
- {
- Assert.assertThat("Frame Count",frames.size(), is(expected));
- }
-
- public void assertHasFrame(byte opcode, long channelId, int expectedCount)
- {
- int actualCount = 0;
-
- for (MuxedFrame frame : frames)
- {
- if (frame.getChannelId() == channelId)
- {
- if (frame.getOpCode() == opcode)
- {
- actualCount++;
- }
- }
- }
-
- Assert.assertThat("Expected Count of " + OpCode.name(opcode) + " frames on Channel ID " + channelId,actualCount,is(expectedCount));
- }
-
- public void assertHasOp(byte opCode, int expectedCount)
- {
- int actualCount = 0;
- for (MuxControlBlock block : ops)
- {
- if (block.getOpCode() == opCode)
- {
- actualCount++;
- }
- }
- Assert.assertThat("Op[" + opCode + "] count",actualCount,is(expectedCount));
- }
-
- public LinkedList getFrames()
- {
- return frames;
- }
-
- public LinkedList getOps()
- {
- return ops;
- }
-
- @Override
- public void onMuxAddChannelRequest(MuxAddChannelRequest request)
- {
- ops.add(request);
- }
-
- @Override
- public void onMuxAddChannelResponse(MuxAddChannelResponse response)
- {
- ops.add(response);
- }
-
- @Override
- public void onMuxDropChannel(MuxDropChannel drop)
- {
- ops.add(drop);
- }
-
- @Override
- public void onMuxedFrame(MuxedFrame frame)
- {
- frames.add(new MuxedFrame(frame));
- }
-
- @Override
- public void onMuxException(MuxException e)
- {
- LOG.debug(e);
- errors.add(e);
- }
-
- @Override
- public void onMuxFlowControl(MuxFlowControl flow)
- {
- ops.add(flow);
- }
-
- @Override
- public void onMuxNewChannelSlot(MuxNewChannelSlot slot)
- {
- ops.add(slot);
- }
-
- public void reset()
- {
- frames.clear();
- ops.clear();
- }
-}
diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java
deleted file mode 100644
index b97f4feeb3b..00000000000
--- a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/MuxGeneratorWrite139SizeTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-//
-// ========================================================================
-// Copyright (c) 1995-2014 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;
-
-import static org.hamcrest.Matchers.is;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-
-import org.eclipse.jetty.util.BufferUtil;
-import org.eclipse.jetty.util.TypeUtil;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-@RunWith(Parameterized.class)
-public class MuxGeneratorWrite139SizeTest
-{
- private static MuxGenerator generator = new MuxGenerator();
-
- @Parameters
- public static Collection