Improving output seen during websocket-tests to squelch known stacktraces produced by testcase

This commit is contained in:
Joakim Erdfelt 2017-07-17 14:18:17 -07:00
parent 068a1f9e40
commit 273dcc4131
13 changed files with 74 additions and 78 deletions

View File

@ -26,7 +26,6 @@ import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -47,9 +46,6 @@ public class MessageOutputStreamTest
{
private static final Logger LOG = Log.getLogger(MessageOutputStreamTest.class);
@Rule
public TestTracker testtracker = new TestTracker();
@Rule
public TestName testname = new TestName();

View File

@ -23,7 +23,6 @@ import static org.hamcrest.Matchers.is;
import java.net.URI;
import java.util.Arrays;
import org.eclipse.jetty.toolchain.test.TestTracker;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
@ -43,9 +42,6 @@ public class MessageWriterTest
{
private static final Logger LOG = Log.getLogger(MessageWriterTest.class);
@Rule
public TestTracker testtracker = new TestTracker();
@Rule
public TestName testname = new TestName();

View File

@ -26,12 +26,12 @@ import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.BadFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -72,7 +72,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -94,7 +94,7 @@ public class BadOpCodesTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello")); // echo
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -30,7 +30,6 @@ import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.CloseFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
@ -40,6 +39,7 @@ import org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection;
import org.eclipse.jetty.websocket.tests.BadFrame;
import org.eclipse.jetty.websocket.tests.DataUtils;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -66,7 +66,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -98,7 +98,7 @@ public class CloseHandlingTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class,CloseInfo.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -25,11 +25,13 @@ import java.util.List;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.CloseFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -96,7 +98,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);
@ -123,7 +126,8 @@ public class CloseHandling_BadStatusCodesTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignore = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);

View File

@ -25,13 +25,13 @@ import org.eclipse.jetty.toolchain.test.annotation.Slow;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.PongFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -57,7 +57,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -83,7 +83,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -109,7 +109,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1 );
@ -135,7 +135,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -164,7 +164,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("fragment1fragment2"));
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -190,7 +190,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -220,7 +220,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -246,7 +246,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);
@ -276,7 +276,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -302,7 +302,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -328,7 +328,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -354,7 +354,7 @@ public class ContinuationTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -381,7 +381,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -408,7 +408,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -443,7 +443,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("f1,f2,f3,f4,f5"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -470,7 +470,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);
@ -499,7 +499,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -528,7 +528,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -557,7 +557,7 @@ public class ContinuationTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("hello, world"));
expect.add(new CloseInfo(StatusCode.NORMAL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send,1);

View File

@ -25,12 +25,12 @@ import java.util.List;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
import org.eclipse.jetty.websocket.common.frames.PingFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -54,7 +54,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -81,7 +81,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -108,7 +108,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
@ -135,7 +135,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
expect.add(new TextFrame().setPayload("small")); // echo on good frame
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendSegmented(send, 1);
@ -162,7 +162,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -189,7 +189,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
@ -217,7 +217,7 @@ public class ReservedBitTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.PROTOCOL).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);

View File

@ -32,13 +32,13 @@ import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.common.CloseInfo;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.DataFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.tests.DataUtils;
import org.eclipse.jetty.websocket.tests.LocalFuzzer;
import org.eclipse.jetty.websocket.tests.servlets.EchoSocket;
import org.junit.Test;
/**
@ -465,7 +465,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendBulk(send);
session.expect(expect);
@ -483,7 +484,7 @@ public class TextTest extends AbstractLocalServerCase
public void testText_BadUtf8_ByteWise() throws Exception
{
// Disable Long Stacks from Parser (we know this test will throw an exception)
try (StacklessLogging ignored = new StacklessLogging(Parser.class))
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class))
{
ByteBuffer payload = ByteBuffer.allocate(64);
BufferUtil.clearToFill(payload);
@ -554,7 +555,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
session.expect(expect);
@ -592,7 +594,8 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (LocalFuzzer session = server.newLocalFuzzer())
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
session.sendFrames(send);
session.expect(expect);
@ -618,7 +621,7 @@ public class TextTest extends AbstractLocalServerCase
List<WebSocketFrame> expect = new ArrayList<>();
expect.add(new CloseInfo(StatusCode.BAD_PAYLOAD).asFrame());
try (StacklessLogging ignored = new StacklessLogging(Parser.class);
try (StacklessLogging ignored = new StacklessLogging(EchoSocket.class);
LocalFuzzer session = server.newLocalFuzzer())
{
ByteBuffer net = session.asNetworkBuffer(send);

View File

@ -82,7 +82,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri();
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect
@ -124,7 +123,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri();
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect
@ -165,7 +163,6 @@ public class WebSocketOverSSLTest
TrackingEndpoint clientSocket = new TrackingEndpoint("Client");
URI requestUri = server.getServerUri().resolve("/deep?a=b");
System.err.printf("Request URI: %s%n",requestUri.toASCIIString());
Future<Session> fut = client.connect(clientSocket,requestUri);
// wait for connect

View File

@ -28,10 +28,10 @@ import java.util.Arrays;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.toolchain.test.AdvancedRunner;
import org.eclipse.jetty.toolchain.test.Hex;
import org.eclipse.jetty.util.Utf8Appendable.NotUtf8Exception;
import org.eclipse.jetty.util.Utf8StringBuilder;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.log.StdErrLog;
import org.eclipse.jetty.websocket.api.StatusCode;
@ -39,6 +39,7 @@ import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.common.Generator;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.WebSocketSession;
import org.eclipse.jetty.websocket.common.frames.BinaryFrame;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
@ -58,12 +59,10 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
/**
* Test various <a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> specified requirements placed on {@link WebSocketServlet}
*/
@RunWith(AdvancedRunner.class)
public class WebSocketServletRFCTest
{
private static SimpleServletServer server;
@ -221,10 +220,16 @@ public class WebSocketServletRFCTest
UntrustedWSSession clientSession = clientConnectFuture.get(Defaults.CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
UntrustedWSEndpoint clientSocket = clientSession.getUntrustedEndpoint();
try (StacklessLogging ignored = new StacklessLogging(
Log.getLogger(WebSocketSession.class.getName() + ".SERVER"),
Log.getLogger(RFC6455Socket.class)))
{
clientSession.getRemote().sendString("CRASH");
clientSocket.awaitCloseEvent("Client");
clientSocket.assertCloseInfo("Client", StatusCode.SERVER_ERROR, anything());
}
}
/**
* Test http://tools.ietf.org/html/rfc6455#section-4.1 where server side upgrade handling is supposed to be case insensitive.
@ -315,6 +320,8 @@ public class WebSocketServletRFCTest
Generator generator = new Generator(WebSocketPolicy.newServerPolicy(), client.getBufferPool(), false);
try (StacklessLogging ignored = new StacklessLogging(RFC6455Socket.class))
{
WebSocketFrame txt = new TextFrame().setPayload(ByteBuffer.wrap(buf));
txt.setMask(Hex.asByteArray("11223344"));
ByteBuffer bbHeader = generator.generateHeaderBytes(txt);
@ -326,3 +333,4 @@ public class WebSocketServletRFCTest
clientSocket.assertCloseInfo("Client", StatusCode.BAD_PAYLOAD, anything());
}
}
}

View File

@ -39,8 +39,6 @@ public class JettyServerEndpointConfiguratorTest
@Test
public void testServiceLoader()
{
System.out.printf("Service Name: %s%n",ServerEndpointConfig.Configurator.class.getName());
ServiceLoader<ServerEndpointConfig.Configurator> loader = ServiceLoader.load(javax.websocket.server.ServerEndpointConfig.Configurator.class);
assertThat("loader",loader,notNullValue());
Iterator<ServerEndpointConfig.Configurator> iter = loader.iterator();

View File

@ -37,7 +37,6 @@ import org.eclipse.jetty.toolchain.test.TestingDir;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.common.util.TextUtil;
import org.eclipse.jetty.websocket.tests.LeakTrackingBufferPoolRule;
import org.eclipse.jetty.websocket.tests.TrackingEndpoint;
import org.eclipse.jetty.websocket.tests.WSServer;
@ -56,7 +55,6 @@ public class LargeContainerTest
public void echo(javax.websocket.Session session, String msg)
{
// reply with echo
System.err.printf("echo(%s)%n", TextUtil.hint(msg));
session.getAsyncRemote().sendText(msg);
}
}

View File

@ -132,10 +132,6 @@ public class MemoryUsageTest
long heapUsed = heapAfter.getUsed() - heapBefore.getUsed();
long nonHeapUsed = nonHeapAfter.getUsed() - nonHeapBefore.getUsed();
System.out.println("heapUsed = " + heapUsed);
System.out.println("nonHeapUsed = " + nonHeapUsed);
// new CountDownLatch(1).await();
// Assume no more than 25 KiB per session pair (client and server).
long expected = 25 * 1024 * sessionCount;
Assert.assertThat("heap used", heapUsed,lessThan(expected));