Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
This commit is contained in:
commit
e6aa4d43f6
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
@ -50,7 +51,6 @@ import org.eclipse.jetty.websocket.jakarta.tests.WSEndpointTracker;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -116,33 +116,26 @@ public class TextStreamTest
|
|||
send.add(CloseStatus.toFrame(CloseStatus.NORMAL));
|
||||
|
||||
ByteBuffer expectedMessage = DataUtils.copyOf(data);
|
||||
List<Frame> expect = new ArrayList<>();
|
||||
expect.add(new Frame(OpCode.TEXT).setPayload(expectedMessage));
|
||||
expect.add(CloseStatus.toFrame(CloseStatus.NORMAL));
|
||||
|
||||
try (Fuzzer fuzzer = server.newNetworkFuzzer("/echo"))
|
||||
{
|
||||
fuzzer.sendBulk(send);
|
||||
fuzzer.expect(expect);
|
||||
BlockingQueue<Frame> receivedFrames = fuzzer.getOutputFrames();
|
||||
fuzzer.expectMessage(receivedFrames, OpCode.TEXT, expectedMessage);
|
||||
fuzzer.expect(List.of(CloseStatus.toFrame(CloseStatus.NORMAL)));
|
||||
}
|
||||
}
|
||||
|
||||
// TODO These tests incorrectly assumes no frame fragmentation.
|
||||
// When message fragmentation is implemented in PartialStringMessageSink then update
|
||||
// this test to check on the server side for no buffers larger than the maxTextMessageBufferSize.
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testAtMaxDefaultMessageBufferSize() throws Exception
|
||||
{
|
||||
testEcho(container.getDefaultMaxTextMessageBufferSize());
|
||||
}
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
public void testLargerThenMaxDefaultMessageBufferSize() throws Exception
|
||||
{
|
||||
int size = container.getDefaultMaxTextMessageBufferSize() + 16;
|
||||
int maxTextMessageBufferSize = container.getDefaultMaxTextMessageBufferSize();
|
||||
int size = maxTextMessageBufferSize + 16;
|
||||
byte[] data = newData(size);
|
||||
|
||||
List<Frame> send = new ArrayList<>();
|
||||
|
@ -153,19 +146,13 @@ public class TextStreamTest
|
|||
byte[] expectedData = new byte[data.length];
|
||||
System.arraycopy(data, 0, expectedData, 0, data.length);
|
||||
|
||||
// Frames expected are influenced by container.getDefaultMaxTextMessageBufferSize setting
|
||||
ByteBuffer frame1 = ByteBuffer.wrap(expectedData, 0, container.getDefaultMaxTextMessageBufferSize());
|
||||
ByteBuffer frame2 = ByteBuffer
|
||||
.wrap(expectedData, container.getDefaultMaxTextMessageBufferSize(), size - container.getDefaultMaxTextMessageBufferSize());
|
||||
List<Frame> expect = new ArrayList<>();
|
||||
expect.add(new Frame(OpCode.TEXT).setPayload(frame1).setFin(false));
|
||||
expect.add(new Frame(OpCode.CONTINUATION).setPayload(frame2).setFin(true));
|
||||
expect.add(CloseStatus.toFrame(CloseStatus.NORMAL));
|
||||
|
||||
try (Fuzzer fuzzer = server.newNetworkFuzzer("/echo"))
|
||||
{
|
||||
fuzzer.sendBulk(send);
|
||||
fuzzer.expect(expect);
|
||||
|
||||
BlockingQueue<Frame> receivedFrames = fuzzer.getOutputFrames();
|
||||
fuzzer.expectMessage(receivedFrames, OpCode.TEXT, ByteBuffer.wrap(expectedData));
|
||||
fuzzer.expect(List.of(CloseStatus.toFrame(CloseStatus.NORMAL)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue