parent
0a6fd16b52
commit
9acd03f0d9
|
@ -153,6 +153,9 @@ public class MessageOutputStream extends OutputStream
|
|||
// Any flush after the first will be a CONTINUATION frame.
|
||||
frame.setIsContinuation();
|
||||
|
||||
// Buffer has been sent, buffer should have been consumed
|
||||
assert buffer.remaining() == 0;
|
||||
|
||||
BufferUtil.flipToFill(buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.common.message;
|
||||
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -33,7 +28,6 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
|
|||
import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
|
||||
import org.eclipse.jetty.websocket.common.WebSocketSession;
|
||||
import org.eclipse.jetty.websocket.common.io.FramePipes;
|
||||
import org.eclipse.jetty.websocket.common.io.LocalWebSocketConnection;
|
||||
import org.eclipse.jetty.websocket.common.io.LocalWebSocketSession;
|
||||
import org.eclipse.jetty.websocket.common.scopes.SimpleContainerScope;
|
||||
import org.eclipse.jetty.websocket.common.scopes.WebSocketContainerScope;
|
||||
|
@ -45,6 +39,10 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
import static org.hamcrest.Matchers.allOf;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class MessageOutputStreamTest
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(MessageOutputStreamTest.class);
|
||||
|
@ -83,6 +81,7 @@ public class MessageOutputStreamTest
|
|||
remoteSocket = new TrackingSocket("remote");
|
||||
WebSocketSession remoteSession = new LocalWebSocketSession(containerScope,testname,remoteSocket);
|
||||
OutgoingFrames socketPipe = FramePipes.to(remoteSession);
|
||||
remoteSession.open();
|
||||
|
||||
// Local Session
|
||||
TrackingSocket localSocket = new TrackingSocket("local");
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
|
||||
package org.eclipse.jetty.websocket.common.test;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.eclipse.jetty.util.BufferUtil;
|
||||
|
@ -32,6 +30,9 @@ import org.eclipse.jetty.websocket.common.OpCode;
|
|||
import org.eclipse.jetty.websocket.common.WebSocketFrame;
|
||||
import org.junit.Assert;
|
||||
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
public class OutgoingFramesCapture implements OutgoingFrames
|
||||
{
|
||||
private LinkedList<WebSocketFrame> frames = new LinkedList<>();
|
||||
|
@ -89,6 +90,10 @@ public class OutgoingFramesCapture implements OutgoingFrames
|
|||
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
|
||||
{
|
||||
frames.add(WebSocketFrame.copy(frame));
|
||||
// Consume bytes
|
||||
ByteBuffer payload = frame.getPayload();
|
||||
payload.position(payload.limit());
|
||||
// notify callback
|
||||
if (callback != null)
|
||||
{
|
||||
callback.writeSuccess();
|
||||
|
|
Loading…
Reference in New Issue