getFrames()
+ {
+ return frames;
+ }
+
+ @Override
+ public void outgoingFrame(Frame frame, WriteCallback callback)
+ {
+ WebSocketFrame copy = new WebSocketFrame(frame);
+ frames.add(copy);
+ if (callback != null)
+ {
+ callback.writeSuccess();
+ }
+ }
+}
diff --git a/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java
new file mode 100644
index 00000000000..7976515b86d
--- /dev/null
+++ b/jetty-websocket/websocket-mux-extension/src/test/java/org/eclipse/jetty/websocket/mux/helper/UnitParser.java
@@ -0,0 +1,78 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.mux.helper;
+
+import java.nio.ByteBuffer;
+
+import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.io.MappedByteBufferPool;
+import org.eclipse.jetty.util.log.StacklessLogging;
+import org.eclipse.jetty.websocket.api.WebSocketPolicy;
+import org.eclipse.jetty.websocket.common.Parser;
+
+public class UnitParser extends Parser
+{
+ public UnitParser()
+ {
+ this(WebSocketPolicy.newServerPolicy());
+ }
+
+ public UnitParser(ByteBufferPool bufferPool, WebSocketPolicy policy)
+ {
+ super(policy,bufferPool);
+ }
+
+ public UnitParser(WebSocketPolicy policy)
+ {
+ this(new MappedByteBufferPool(),policy);
+ }
+
+ private void parsePartial(ByteBuffer buf, int numBytes)
+ {
+ int len = Math.min(numBytes,buf.remaining());
+ byte arr[] = new byte[len];
+ buf.get(arr,0,len);
+ this.parse(ByteBuffer.wrap(arr));
+ }
+
+ /**
+ * Parse a buffer, but do so in a quiet fashion, squelching stacktraces if encountered.
+ *
+ * Use if you know the parse will cause an exception and just don't wnat to make the test console all noisy.
+ */
+ public void parseQuietly(ByteBuffer buf)
+ {
+ try (StacklessLogging supress = new StacklessLogging(Parser.class))
+ {
+ parse(buf);
+ }
+ catch (Exception ignore)
+ {
+ /* ignore */
+ }
+ }
+
+ public void parseSlowly(ByteBuffer buf, int segmentSize)
+ {
+ while (buf.remaining() > 0)
+ {
+ parsePartial(buf,segmentSize);
+ }
+ }
+}