From f17d271f072ddad5cb8b8803800738e20a71aeb1 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 27 Jul 2011 11:15:38 +1000 Subject: [PATCH] 353073 parallel test option --- .../eclipse/jetty/websocket/TestClient.java | 22 ++++++++----- .../jetty/websocket/WebSocketClient.java | 31 +------------------ 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java index 9c4a9f7855d..202fbb22c12 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/TestClient.java @@ -46,6 +46,7 @@ public class TestClient implements WebSocket.OnFrame private final String _protocol; private final int _timeout; + private static boolean __quiet; private static int __framesSent; private static int __messagesSent; private static AtomicInteger __framesReceived=new AtomicInteger(); @@ -76,6 +77,9 @@ public class TestClient implements WebSocket.OnFrame { try { + if (_connection.isClose(opcode)) + return false; + __framesReceived.incrementAndGet(); _frames++; _messageBytes+=length; @@ -98,7 +102,8 @@ public class TestClient implements WebSocket.OnFrame while(duration1?"s":"")+" ---"); System.out.println(__framesSent+" frames transmitted, "+__framesReceived+" received, "+ __messagesSent+" messages transmitted, "+__messagesReceived+" received, "+ - "time "+duration+"ms"); + "time "+duration+"ms "+ (1000L*__messagesReceived.get()/duration)+" req/s"); System.out.printf("rtt min/ave/max = %.3f/%.3f/%.3f ms\n",__minDuration.get()/1000000.0,__messagesReceived.get()==0?0.0:(__totalTime.get()/__messagesReceived.get()/1000000.0),__maxDuration.get()/1000000.0); __client.stop(); diff --git a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java index 424b1ae8c96..ffee9d0426b 100644 --- a/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java +++ b/jetty-websocket/src/main/java/org/eclipse/jetty/websocket/WebSocketClient.java @@ -43,8 +43,8 @@ public class WebSocketClient extends AggregateLifeCycle public WebSocketClient(ThreadPool threadpool) { _threadPool=threadpool; - addBean(_threadPool); addBean(_selector); + addBean(_threadPool); } public WebSocketClient() @@ -387,33 +387,4 @@ public class WebSocketClient extends AggregateLifeCycle } } - - - - public static void main(String... args) throws Exception - { - Log.getLog().setDebugEnabled(true); - - - WebSocketClient client = new WebSocketClient(); - client.start(); - - client.open(new URI("ws://localhost:8080/websocket"),new WebSocket.OnTextMessage() - { - public void onOpen(org.eclipse.jetty.websocket.WebSocket.Connection connection) - { - System.err.println("onOpen "+connection); - } - - public void onClose(int closeCode, String message) - { - System.err.println("onClose "+closeCode+" "+message); - } - - public void onMessage(String data) - { - System.err.println("onMessage "+data); - } - }); - } }