parent
a8e315a3f5
commit
0e5de87d49
|
@ -100,7 +100,7 @@ public abstract class TrackingSocket
|
|||
|
||||
public void assertWasOpened() throws InterruptedException
|
||||
{
|
||||
Assert.assertThat("Was Opened",openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
|
||||
Assert.assertThat("Was Opened",openLatch.await(30000,TimeUnit.MILLISECONDS),is(true));
|
||||
}
|
||||
|
||||
public void clear()
|
||||
|
|
|
@ -100,7 +100,7 @@ public abstract class TrackingSocket
|
|||
|
||||
public void assertWasOpened() throws InterruptedException
|
||||
{
|
||||
Assert.assertThat("Was Opened",openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
|
||||
Assert.assertThat("Was Opened",openLatch.await(30000,TimeUnit.MILLISECONDS),is(true));
|
||||
}
|
||||
|
||||
public void clear()
|
||||
|
|
|
@ -126,18 +126,18 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
public WebSocketClient(SslContextFactory sslContextFactory, Executor executor, ByteBufferPool bufferPool, DecoratedObjectFactory objectFactory)
|
||||
{
|
||||
this.executor = executor;
|
||||
|
||||
this.sslContextFactory = sslContextFactory;
|
||||
this.bufferPool = bufferPool;
|
||||
if(sslContextFactory!=null)
|
||||
addBean(sslContextFactory);
|
||||
setExecutor(executor);
|
||||
setBufferPool(bufferPool);
|
||||
|
||||
this.objectFactory = objectFactory;
|
||||
this.extensionRegistry = new WebSocketExtensionFactory(this);
|
||||
|
||||
this.masker = new RandomMasker();
|
||||
this.eventDriverFactory = new EventDriverFactory(policy);
|
||||
|
||||
addBean(this.executor);
|
||||
addBean(this.sslContextFactory);
|
||||
addBean(this.bufferPool);
|
||||
}
|
||||
|
||||
public Future<Session> connect(Object websocket, URI toUri) throws IOException
|
||||
|
@ -239,33 +239,27 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Starting {}",this);
|
||||
|
||||
if (sslContextFactory != null)
|
||||
{
|
||||
addBean(sslContextFactory);
|
||||
}
|
||||
|
||||
String name = WebSocketClient.class.getSimpleName() + "@" + hashCode();
|
||||
|
||||
if (bufferPool == null)
|
||||
{
|
||||
bufferPool = new MappedByteBufferPool();
|
||||
setBufferPool(new MappedByteBufferPool());
|
||||
}
|
||||
addBean(bufferPool);
|
||||
|
||||
if (scheduler == null)
|
||||
{
|
||||
scheduler = new ScheduledExecutorScheduler(name + "-scheduler",daemon);
|
||||
addBean(scheduler);
|
||||
}
|
||||
addBean(scheduler);
|
||||
|
||||
if (cookieStore == null)
|
||||
{
|
||||
cookieStore = new HttpCookieStore.Empty();
|
||||
setCookieStore(new HttpCookieStore.Empty());
|
||||
}
|
||||
|
||||
if(this.sessionFactory == null)
|
||||
{
|
||||
this.sessionFactory = new WebSocketSessionFactory(this);
|
||||
setSessionFactory(new WebSocketSessionFactory(this));
|
||||
}
|
||||
|
||||
if(this.objectFactory == null)
|
||||
|
@ -285,19 +279,20 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Stopping {}",this);
|
||||
|
||||
|
||||
if (ShutdownThread.isRegistered(this))
|
||||
{
|
||||
ShutdownThread.deregister(this);
|
||||
}
|
||||
|
||||
super.doStop();
|
||||
|
||||
if (cookieStore != null)
|
||||
{
|
||||
cookieStore.removeAll();
|
||||
cookieStore = null;
|
||||
}
|
||||
|
||||
super.doStop();
|
||||
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Stopped {}",this);
|
||||
}
|
||||
|
@ -523,6 +518,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
public void setBufferPool(ByteBufferPool bufferPool)
|
||||
{
|
||||
updateBean(this.bufferPool,bufferPool);
|
||||
this.bufferPool = bufferPool;
|
||||
}
|
||||
|
||||
|
@ -543,6 +539,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
public void setCookieStore(CookieStore cookieStore)
|
||||
{
|
||||
updateBean(this.cookieStore,cookieStore);
|
||||
this.cookieStore = cookieStore;
|
||||
}
|
||||
|
||||
|
@ -597,6 +594,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
|||
|
||||
public void setSessionFactory(SessionFactory sessionFactory)
|
||||
{
|
||||
updateBean(this.sessionFactory,sessionFactory);
|
||||
this.sessionFactory = sessionFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,8 @@ public class BadNetworkTest
|
|||
ssocket.upgrade();
|
||||
|
||||
// Validate that we are connected
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
wsocket.waitForConnected(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
wsocket.waitForConnected(30,TimeUnit.SECONDS);
|
||||
|
||||
// Have client disconnect abruptly
|
||||
Session session = wsocket.getSession();
|
||||
|
@ -114,8 +114,8 @@ public class BadNetworkTest
|
|||
ssocket.upgrade();
|
||||
|
||||
// Validate that we are connected
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
wsocket.waitForConnected(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
wsocket.waitForConnected(30,TimeUnit.SECONDS);
|
||||
|
||||
// Have server disconnect abruptly
|
||||
ssocket.disconnect();
|
||||
|
|
|
@ -113,7 +113,7 @@ public class ClientCloseTest
|
|||
public void assertReceivedError(Class<? extends Throwable> expectedThrownClass, Matcher<String> messageMatcher) throws TimeoutException,
|
||||
InterruptedException
|
||||
{
|
||||
errorQueue.awaitEventCount(1,500,TimeUnit.MILLISECONDS);
|
||||
errorQueue.awaitEventCount(1,30,TimeUnit.SECONDS);
|
||||
Throwable actual = errorQueue.poll();
|
||||
Assert.assertThat("Client Error Event",actual,instanceOf(expectedThrownClass));
|
||||
if (messageMatcher == null)
|
||||
|
@ -191,10 +191,10 @@ public class ClientCloseTest
|
|||
private void confirmConnection(CloseTrackingSocket clientSocket, Future<Session> clientFuture, IBlockheadServerConnection serverConns) throws Exception
|
||||
{
|
||||
// Wait for client connect on via future
|
||||
clientFuture.get(500,TimeUnit.MILLISECONDS);
|
||||
clientFuture.get(30,TimeUnit.SECONDS);
|
||||
|
||||
// Wait for client connect via client websocket
|
||||
Assert.assertThat("Client WebSocket is Open",clientSocket.openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
|
||||
Assert.assertThat("Client WebSocket is Open",clientSocket.openLatch.await(30,TimeUnit.SECONDS),is(true));
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -203,10 +203,10 @@ public class ClientCloseTest
|
|||
Future<Void> testFut = clientSocket.getRemote().sendStringByFuture(echoMsg);
|
||||
|
||||
// Wait for send future
|
||||
testFut.get(500,TimeUnit.MILLISECONDS);
|
||||
testFut.get(30,TimeUnit.SECONDS);
|
||||
|
||||
// Read Frame on server side
|
||||
IncomingFramesCapture serverCapture = serverConns.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
IncomingFramesCapture serverCapture = serverConns.readFrames(1,30,TimeUnit.SECONDS);
|
||||
serverCapture.assertNoErrors();
|
||||
serverCapture.assertFrameCount(1);
|
||||
WebSocketFrame frame = serverCapture.getFrames().poll();
|
||||
|
@ -235,7 +235,7 @@ public class ClientCloseTest
|
|||
private void confirmServerReceivedCloseFrame(IBlockheadServerConnection serverConn, int expectedCloseCode, Matcher<String> closeReasonMatcher) throws IOException,
|
||||
TimeoutException
|
||||
{
|
||||
IncomingFramesCapture serverCapture = serverConn.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
IncomingFramesCapture serverCapture = serverConn.readFrames(1,30,TimeUnit.SECONDS);
|
||||
serverCapture.assertNoErrors();
|
||||
serverCapture.assertFrameCount(1);
|
||||
serverCapture.assertHasFrame(OpCode.CLOSE,1);
|
||||
|
|
|
@ -122,7 +122,7 @@ public class ClientConnectTest
|
|||
IBlockheadServerConnection connection = server.accept();
|
||||
connection.upgrade();
|
||||
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30,TimeUnit.SECONDS);
|
||||
|
||||
sess.close();
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -175,7 +175,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -211,7 +211,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -247,7 +247,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -283,7 +283,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -312,7 +312,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> UpgradeException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -338,7 +338,7 @@ public class ClientConnectTest
|
|||
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(3,TimeUnit.SECONDS);
|
||||
Assert.fail("Should have Timed Out");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
@ -367,7 +367,7 @@ public class ClientConnectTest
|
|||
Future<Session> future = client.connect(wsocket,wsUri);
|
||||
|
||||
// The attempt to get upgrade response future should throw error
|
||||
future.get(1000,TimeUnit.MILLISECONDS);
|
||||
future.get(3,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> ConnectException");
|
||||
}
|
||||
catch (ConnectException e)
|
||||
|
@ -406,7 +406,7 @@ public class ClientConnectTest
|
|||
// The attempt to get upgrade response future should throw error
|
||||
try
|
||||
{
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(3,TimeUnit.SECONDS);
|
||||
Assert.fail("Expected ExecutionException -> TimeoutException");
|
||||
}
|
||||
catch (ExecutionException e)
|
||||
|
|
|
@ -169,7 +169,7 @@ public class CookieTest
|
|||
serverConn.close(StatusCode.NORMAL);
|
||||
|
||||
// Confirm client connect on future
|
||||
clientConnectFuture.get(500,TimeUnit.MILLISECONDS);
|
||||
clientConnectFuture.get(30000,TimeUnit.MILLISECONDS);
|
||||
|
||||
// Wait for client receipt of cookie frame via client websocket
|
||||
clientSocket.messageQueue.awaitEventCount(1,2,TimeUnit.SECONDS);
|
||||
|
|
|
@ -94,7 +94,7 @@ public class JettyTrackingSocket extends WebSocketAdapter
|
|||
|
||||
public void assertWasOpened() throws InterruptedException
|
||||
{
|
||||
Assert.assertThat("Was Opened",openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
|
||||
Assert.assertThat("Was Opened",openLatch.await(30,TimeUnit.SECONDS),is(true));
|
||||
}
|
||||
|
||||
public void awaitMessage(int expectedMessageCount, TimeUnit timeoutUnit, int timeoutDuration) throws TimeoutException, InterruptedException
|
||||
|
|
|
@ -73,7 +73,7 @@ public class SessionTest
|
|||
final IBlockheadServerConnection srvSock = server.accept();
|
||||
srvSock.upgrade();
|
||||
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30000,TimeUnit.MILLISECONDS);
|
||||
Assert.assertThat("Session",sess,notNullValue());
|
||||
Assert.assertThat("Session.open",sess.isOpen(),is(true));
|
||||
Assert.assertThat("Session.upgradeRequest",sess.getUpgradeRequest(),notNullValue());
|
||||
|
@ -91,9 +91,9 @@ public class SessionTest
|
|||
{
|
||||
remote.flush();
|
||||
}
|
||||
srvSock.echoMessage(1,500,TimeUnit.MILLISECONDS);
|
||||
srvSock.echoMessage(1,30000,TimeUnit.MILLISECONDS);
|
||||
// wait for response from server
|
||||
cliSock.waitForMessage(500,TimeUnit.MILLISECONDS);
|
||||
cliSock.waitForMessage(30000,TimeUnit.MILLISECONDS);
|
||||
|
||||
Set<WebSocketSession> open = client.getOpenSessions();
|
||||
Assert.assertThat("(Before Close) Open Sessions.size", open.size(), is(1));
|
||||
|
@ -102,8 +102,9 @@ public class SessionTest
|
|||
cliSock.close();
|
||||
srvSock.close();
|
||||
|
||||
cliSock.waitForClose(500,TimeUnit.MILLISECONDS);
|
||||
cliSock.waitForClose(30000,TimeUnit.MILLISECONDS);
|
||||
open = client.getOpenSessions();
|
||||
// TODO this sometimes fails!
|
||||
Assert.assertThat("(After Close) Open Sessions.size", open.size(), is(0));
|
||||
}
|
||||
finally
|
||||
|
|
|
@ -86,8 +86,8 @@ public class SlowClientTest
|
|||
sconnection.upgrade();
|
||||
|
||||
// Confirm connected
|
||||
future.get(500, TimeUnit.MILLISECONDS);
|
||||
tsocket.waitForConnected(500, TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
tsocket.waitForConnected(30,TimeUnit.SECONDS);
|
||||
|
||||
int messageCount = 10;
|
||||
|
||||
|
|
|
@ -88,8 +88,8 @@ public class SlowServerTest
|
|||
sconnection.upgrade();
|
||||
|
||||
// Confirm connected
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
tsocket.waitForConnected(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
tsocket.waitForConnected(30,TimeUnit.SECONDS);
|
||||
|
||||
int messageCount = 10;
|
||||
|
||||
|
@ -135,8 +135,8 @@ public class SlowServerTest
|
|||
serverConn.upgrade();
|
||||
|
||||
// Confirm connected
|
||||
clientConnectFuture.get(500,TimeUnit.MILLISECONDS);
|
||||
clientSocket.waitForConnected(500,TimeUnit.MILLISECONDS);
|
||||
clientConnectFuture.get(30,TimeUnit.SECONDS);
|
||||
clientSocket.waitForConnected(30,TimeUnit.SECONDS);
|
||||
|
||||
// Have server write slowly.
|
||||
int messageCount = 1000;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class WebSocketClientTest
|
|||
final IBlockheadServerConnection srvSock = server.accept();
|
||||
srvSock.upgrade();
|
||||
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30,TimeUnit.SECONDS);
|
||||
Assert.assertThat("Session",sess,notNullValue());
|
||||
Assert.assertThat("Session.open",sess.isOpen(),is(true));
|
||||
Assert.assertThat("Session.upgradeRequest",sess.getUpgradeRequest(),notNullValue());
|
||||
|
@ -124,9 +124,9 @@ public class WebSocketClientTest
|
|||
remote.sendStringByFuture("Hello World!");
|
||||
if (remote.getBatchMode() == BatchMode.ON)
|
||||
remote.flush();
|
||||
srvSock.echoMessage(1,500,TimeUnit.MILLISECONDS);
|
||||
srvSock.echoMessage(1,30,TimeUnit.SECONDS);
|
||||
// wait for response from server
|
||||
cliSock.waitForMessage(500,TimeUnit.MILLISECONDS);
|
||||
cliSock.waitForMessage(30,TimeUnit.SECONDS);
|
||||
|
||||
cliSock.assertMessage("Hello World!");
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class WebSocketClientTest
|
|||
final IBlockheadServerConnection srvSock = server.accept();
|
||||
srvSock.upgrade();
|
||||
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30,TimeUnit.SECONDS);
|
||||
Assert.assertThat("Session",sess,notNullValue());
|
||||
Assert.assertThat("Session.open",sess.isOpen(),is(true));
|
||||
Assert.assertThat("Session.upgradeRequest",sess.getUpgradeRequest(),notNullValue());
|
||||
|
@ -193,7 +193,7 @@ public class WebSocketClientTest
|
|||
srvSock.upgrade();
|
||||
|
||||
// Validate connect
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30,TimeUnit.SECONDS);
|
||||
Assert.assertThat("Session",sess,notNullValue());
|
||||
Assert.assertThat("Session.open",sess.isOpen(),is(true));
|
||||
Assert.assertThat("Session.upgradeRequest",sess.getUpgradeRequest(),notNullValue());
|
||||
|
@ -203,7 +203,7 @@ public class WebSocketClientTest
|
|||
srvSock.write(new TextFrame().setPayload("Hello World"));
|
||||
|
||||
// Verify connect
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
wsocket.assertWasOpened();
|
||||
wsocket.awaitMessage(1,TimeUnit.SECONDS,2);
|
||||
|
||||
|
@ -230,7 +230,7 @@ public class WebSocketClientTest
|
|||
IBlockheadServerConnection ssocket = server.accept();
|
||||
ssocket.upgrade();
|
||||
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
|
||||
Assert.assertTrue(wsocket.openLatch.await(1,TimeUnit.SECONDS));
|
||||
|
||||
|
@ -270,7 +270,7 @@ public class WebSocketClientTest
|
|||
IBlockheadServerConnection ssocket = server.accept();
|
||||
ssocket.upgrade();
|
||||
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
|
||||
Assert.assertTrue(wsocket.openLatch.await(1,TimeUnit.SECONDS));
|
||||
|
||||
|
@ -310,7 +310,7 @@ public class WebSocketClientTest
|
|||
|
||||
wsocket.awaitConnect(1,TimeUnit.SECONDS);
|
||||
|
||||
Session sess = future.get(500,TimeUnit.MILLISECONDS);
|
||||
Session sess = future.get(30,TimeUnit.SECONDS);
|
||||
Assert.assertThat("Session",sess,notNullValue());
|
||||
Assert.assertThat("Session.open",sess.isOpen(),is(true));
|
||||
|
||||
|
@ -350,7 +350,7 @@ public class WebSocketClientTest
|
|||
IBlockheadServerConnection ssocket = server.accept();
|
||||
ssocket.upgrade();
|
||||
|
||||
future.get(500,TimeUnit.MILLISECONDS);
|
||||
future.get(30,TimeUnit.SECONDS);
|
||||
|
||||
Assert.assertTrue(wsocket.openLatch.await(1,TimeUnit.SECONDS));
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ public class TrackingSocket extends WebSocketAdapter
|
|||
|
||||
public void assertWasOpened() throws InterruptedException
|
||||
{
|
||||
Assert.assertThat("Was Opened",openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
|
||||
Assert.assertThat("Was Opened",openLatch.await(30,TimeUnit.SECONDS),is(true));
|
||||
}
|
||||
|
||||
public void awaitMessage(int expectedMessageCount, TimeUnit timeoutUnit, int timeoutDuration) throws TimeoutException, InterruptedException
|
||||
|
|
|
@ -105,7 +105,7 @@ public class AnnotatedMaxMessageSizeTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code",tf.getPayloadAsUTF8(),is(msg));
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class AnnotatedMaxMessageSizeTest
|
|||
client.write(new TextFrame().setPayload(ByteBuffer.wrap(buf)));
|
||||
|
||||
// Read frame (hopefully close frame saying its too large)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Frame is close", tf.getOpCode(), is(OpCode.CLOSE));
|
||||
CloseInfo close = new CloseInfo(tf);
|
||||
|
|
|
@ -73,7 +73,7 @@ public class ChromeTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code",tf.getPayloadAsUTF8(),is(msg));
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class FirefoxTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1, 500, TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1, 30, TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code", tf.getPayloadAsUTF8(), is(msg));
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class IdleTimeoutTest
|
|||
client.write(new TextFrame().setPayload("Hello"));
|
||||
|
||||
// Expect server to have closed due to its own timeout
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame frame = frames.poll();
|
||||
Assert.assertThat("frame opcode",frame.getOpCode(),is(OpCode.CLOSE));
|
||||
CloseInfo close = new CloseInfo(frame);
|
||||
|
|
|
@ -92,7 +92,7 @@ public class WebSocketOverSSLTest
|
|||
remote.flush();
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
clientSocket.messages.awaitEventCount(1,500,TimeUnit.MILLISECONDS);
|
||||
clientSocket.messages.awaitEventCount(1,30,TimeUnit.SECONDS);
|
||||
EventQueue<String> captured = clientSocket.messages;
|
||||
Assert.assertThat("Text Message",captured.poll(),is(msg));
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class WebSocketOverSSLTest
|
|||
remote.flush();
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
clientSocket.messages.awaitEventCount(1,500,TimeUnit.MILLISECONDS);
|
||||
clientSocket.messages.awaitEventCount(1,30,TimeUnit.SECONDS);
|
||||
EventQueue<String> captured = clientSocket.messages;
|
||||
Assert.assertThat("Server.session.isSecure",captured.poll(),is("session.isSecure=true"));
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class WebSocketOverSSLTest
|
|||
remote.flush();
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
clientSocket.messages.awaitEventCount(1,500,TimeUnit.MILLISECONDS);
|
||||
clientSocket.messages.awaitEventCount(1,30,TimeUnit.SECONDS);
|
||||
EventQueue<String> captured = clientSocket.messages;
|
||||
String expected = String.format("session.upgradeRequest.requestURI=%s",requestUri.toASCIIString());
|
||||
Assert.assertThat("session.upgradeRequest.requestURI",captured.poll(),is(expected));
|
||||
|
|
|
@ -191,7 +191,7 @@ public class WebSocketServletRFCTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code",tf.getPayloadAsUTF8(),is(msg));
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public class WebSocketServletRFCTest
|
|||
client.write(new TextFrame().setPayload("CRASH"));
|
||||
|
||||
// Read frame (hopefully close frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
Frame cf = frames.poll();
|
||||
CloseInfo close = new CloseInfo(cf);
|
||||
Assert.assertThat("Close Frame.status code",close.getStatusCode(),is(StatusCode.SERVER_ERROR));
|
||||
|
@ -263,7 +263,7 @@ public class WebSocketServletRFCTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code",tf.getPayloadAsUTF8(),is(msg));
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ public class WebSocketServletRFCTest
|
|||
client.write(new TextFrame().setPayload(msg));
|
||||
|
||||
// Read frame (hopefully text frame)
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,500,TimeUnit.MILLISECONDS);
|
||||
EventQueue<WebSocketFrame> frames = client.readFrames(1,30,TimeUnit.SECONDS);
|
||||
WebSocketFrame tf = frames.poll();
|
||||
Assert.assertThat("Text Frame.status code",tf.getPayloadAsUTF8(),is(msg));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue