Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Gottox committed Feb 20, 2012
1 parent 01cea3b commit c9455dc
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions tests/io/socket/TestSocketIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;

Expand All @@ -21,9 +19,9 @@

@RunWith(io.socket.RandomBlockJUnit4ClassRunner.class)
public class TestSocketIO implements IOCallback {
private final static String NODE = "C:\\Program Files (x86)\\nodejs\\node.exe";
private final static String NODE = "/opt/local/bin/node";
private static final int PORT = 10214;
private static final int TIMEOUT = 2;
private static final int TIMEOUT = 200;
LinkedBlockingQueue<String> events;
LinkedBlockingQueue<String> outputs;
LinkedBlockingQueue<Object> args;
Expand All @@ -47,7 +45,7 @@ public void setUp() throws Exception {
outputs = new LinkedBlockingQueue<String>();
args = new LinkedBlockingQueue<Object>();
node = Runtime.getRuntime().exec(
new String[] { NODE, "./node/socketio.js", "" + PORT });
new String[] { NODE, "./tests/io/socket/socketio.js", "" + PORT });

stdoutThread = new Thread("stdoutThread") {
public void run() {
Expand Down Expand Up @@ -222,6 +220,21 @@ public void error() throws Exception {
assertEquals("onError", takeEvent());
doClose();
}

@Test
public void acknowledge() throws Exception {
doConnect();
socket.emit("echoAck", new IOAcknowledge() {
@Override
public void ack(Object... args) {
events.add("ack");
TestSocketIO.this.args.addAll(Arrays.asList(args));
}
}, "TESTSTRING");
assertEquals("ack", takeEvent());
assertEquals("TESTSTRING", takeArg());
doClose();
}

// END TESTS

Expand Down

0 comments on commit c9455dc

Please sign in to comment.