Issue #427 - Squelch intentional exceptions seen during websocket testing
This commit is contained in:
parent
684c96a156
commit
464c46a757
|
@ -36,12 +36,7 @@ public class ListenerRuntimeOnConnectSocket extends WebSocketAdapter
|
||||||
{
|
{
|
||||||
super.onWebSocketConnect(sess);
|
super.onWebSocketConnect(sess);
|
||||||
|
|
||||||
// Intentional runtime exception.
|
throw new ArrayIndexOutOfBoundsException("Intentional Exception");
|
||||||
int[] arr = new int[5];
|
|
||||||
for (int i = 0; i < 10; i++)
|
|
||||||
{
|
|
||||||
arr[i] = 222;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -18,9 +18,6 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.server.misbehaving;
|
package org.eclipse.jetty.websocket.server.misbehaving;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.eclipse.jetty.toolchain.test.EventQueue;
|
import org.eclipse.jetty.toolchain.test.EventQueue;
|
||||||
|
@ -29,7 +26,7 @@ import org.eclipse.jetty.websocket.api.StatusCode;
|
||||||
import org.eclipse.jetty.websocket.common.CloseInfo;
|
import org.eclipse.jetty.websocket.common.CloseInfo;
|
||||||
import org.eclipse.jetty.websocket.common.OpCode;
|
import org.eclipse.jetty.websocket.common.OpCode;
|
||||||
import org.eclipse.jetty.websocket.common.WebSocketFrame;
|
import org.eclipse.jetty.websocket.common.WebSocketFrame;
|
||||||
import org.eclipse.jetty.websocket.common.events.AbstractEventDriver;
|
import org.eclipse.jetty.websocket.common.WebSocketSession;
|
||||||
import org.eclipse.jetty.websocket.common.test.BlockheadClient;
|
import org.eclipse.jetty.websocket.common.test.BlockheadClient;
|
||||||
import org.eclipse.jetty.websocket.common.test.IBlockheadClient;
|
import org.eclipse.jetty.websocket.common.test.IBlockheadClient;
|
||||||
import org.eclipse.jetty.websocket.server.SimpleServletServer;
|
import org.eclipse.jetty.websocket.server.SimpleServletServer;
|
||||||
|
@ -37,6 +34,10 @@ import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.instanceOf;
|
||||||
|
import static org.hamcrest.Matchers.is;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Testing badly behaving Socket class implementations to get the best
|
* Testing badly behaving Socket class implementations to get the best
|
||||||
* error messages and state out of the websocket implementation.
|
* error messages and state out of the websocket implementation.
|
||||||
|
@ -67,7 +68,7 @@ public class MisbehavingClassTest
|
||||||
{
|
{
|
||||||
client.setProtocols("listener-runtime-connect");
|
client.setProtocols("listener-runtime-connect");
|
||||||
client.setTimeout(1,TimeUnit.SECONDS);
|
client.setTimeout(1,TimeUnit.SECONDS);
|
||||||
try (StacklessLogging scope = new StacklessLogging(AbstractEventDriver.class))
|
try (StacklessLogging scope = new StacklessLogging(ListenerRuntimeOnConnectSocket.class, WebSocketSession.class))
|
||||||
{
|
{
|
||||||
ListenerRuntimeOnConnectSocket socket = badSocketsServlet.listenerRuntimeConnect;
|
ListenerRuntimeOnConnectSocket socket = badSocketsServlet.listenerRuntimeConnect;
|
||||||
socket.reset();
|
socket.reset();
|
||||||
|
@ -103,7 +104,7 @@ public class MisbehavingClassTest
|
||||||
{
|
{
|
||||||
client.setProtocols("annotated-runtime-connect");
|
client.setProtocols("annotated-runtime-connect");
|
||||||
client.setTimeout(1,TimeUnit.SECONDS);
|
client.setTimeout(1,TimeUnit.SECONDS);
|
||||||
try (StacklessLogging scope = new StacklessLogging(AbstractEventDriver.class))
|
try (StacklessLogging scope = new StacklessLogging(AnnotatedRuntimeOnConnectSocket.class, WebSocketSession.class))
|
||||||
{
|
{
|
||||||
AnnotatedRuntimeOnConnectSocket socket = badSocketsServlet.annotatedRuntimeConnect;
|
AnnotatedRuntimeOnConnectSocket socket = badSocketsServlet.annotatedRuntimeConnect;
|
||||||
socket.reset();
|
socket.reset();
|
||||||
|
|
Loading…
Reference in New Issue