|
21 | 21 | public class TestSocketIO implements IOCallback { |
22 | 22 | private final static String NODE = "/opt/local/bin/node"; |
23 | 23 | private static final int PORT = 10214; |
24 | | - private static final int TIMEOUT = 200; |
| 24 | + private static final int TIMEOUT = 2; |
25 | 25 | LinkedBlockingQueue<String> events; |
26 | 26 | LinkedBlockingQueue<String> outputs; |
27 | 27 | LinkedBlockingQueue<Object> args; |
@@ -94,10 +94,20 @@ public void run() { |
94 | 94 |
|
95 | 95 | @After |
96 | 96 | public void tearDown() throws Exception { |
| 97 | + |
97 | 98 | node.destroy(); |
98 | 99 | stderrThread.interrupt(); |
99 | 100 | stdoutThread.interrupt(); |
100 | 101 | node.waitFor(); |
| 102 | + for(String s : events) { |
| 103 | + System.out.println("Event in Queue: " + s); |
| 104 | + } |
| 105 | + for(String line : outputs) { |
| 106 | + System.out.println("Line in Queue: " + line); |
| 107 | + } |
| 108 | + for(Object o : args) { |
| 109 | + System.out.println("Argument in Queue: " + o.toString()); |
| 110 | + } |
101 | 111 | } |
102 | 112 |
|
103 | 113 | void doConnect() throws Exception { |
@@ -135,6 +145,7 @@ public void send() throws Exception { |
135 | 145 | @Test |
136 | 146 | public void emitAndOn() throws Exception { |
137 | 147 | doConnect(); |
| 148 | + |
138 | 149 | String str = "TESTSTRING"; |
139 | 150 | socket.emit("echo", str); |
140 | 151 | assertEquals("Test String", "on", takeEvent()); |
@@ -168,11 +179,11 @@ public void emitAndMessage() throws Exception { |
168 | 179 |
|
169 | 180 | @Test |
170 | 181 | public void namespaces() throws Exception { |
171 | | - doConnect(); |
172 | 182 | SocketIO ns1 = new SocketIO("http://127.0.0.1:" + PORT + "/ns1", this); |
173 | 183 | assertEquals("onConnect", takeEvent()); |
174 | | - assertEquals("onMessage_string", takeEvent()); |
175 | | - assertEquals("ns1", takeArg()); |
| 184 | + |
| 185 | + doConnect(); |
| 186 | + |
176 | 187 | ns1.disconnect(); |
177 | 188 | assertEquals("onDisconnect", takeEvent()); |
178 | 189 |
|
|
0 commit comments