compitible with engine.io 0.8.2
This commit is contained in:
@@ -10,6 +10,8 @@ import org.junit.runners.JUnit4;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertThat;
|
||||
@@ -47,7 +49,7 @@ public class SocketTest {
|
||||
*/
|
||||
@Test
|
||||
public void socketClosing() throws URISyntaxException, InterruptedException {
|
||||
Socket socket = new Socket("ws://localhost:8080") {
|
||||
Socket socket = new Socket("ws://0.0.0.0:8080") {
|
||||
@Override
|
||||
public void onopen() {}
|
||||
@Override
|
||||
@@ -59,6 +61,19 @@ public class SocketTest {
|
||||
};
|
||||
final boolean[] closed = {false};
|
||||
|
||||
socket.once(Socket.EVENT_ERROR, new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
Timer timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
assertThat(closed[0], is(false));
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on(Socket.EVENT_CLOSE, new Emitter.Listener() {
|
||||
@Override
|
||||
public void call(Object... args) {
|
||||
@@ -66,8 +81,5 @@ public class SocketTest {
|
||||
}
|
||||
});
|
||||
socket.open();
|
||||
|
||||
Thread.sleep(200);
|
||||
assertThat(closed[0], is(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ public class TransportTest {
|
||||
opt.query = new HashMap<String, String>() {{
|
||||
put("sid", "test");
|
||||
}};
|
||||
opt.timestampRequests = false;
|
||||
Polling polling = new Polling(opt);
|
||||
assertThat(polling.uri(), is("http://localhost/engine.io?sid=test"));
|
||||
}
|
||||
@@ -37,6 +38,7 @@ public class TransportTest {
|
||||
put("sid", "test");
|
||||
}};
|
||||
opt.port = 80;
|
||||
opt.timestampRequests = false;
|
||||
Polling polling = new Polling(opt);
|
||||
assertThat(polling.uri(), is("http://localhost/engine.io?sid=test"));
|
||||
}
|
||||
@@ -51,6 +53,7 @@ public class TransportTest {
|
||||
put("sid", "test");
|
||||
}};
|
||||
opt.port = 3000;
|
||||
opt.timestampRequests = false;
|
||||
Polling polling = new Polling(opt);
|
||||
assertThat(polling.uri(), is("http://localhost:3000/engine.io?sid=test"));
|
||||
}
|
||||
@@ -65,6 +68,7 @@ public class TransportTest {
|
||||
put("sid", "test");
|
||||
}};
|
||||
opt.port = 443;
|
||||
opt.timestampRequests = false;
|
||||
Polling polling = new Polling(opt);
|
||||
assertThat(polling.uri(), is("https://localhost/engine.io?sid=test"));
|
||||
}
|
||||
@@ -89,6 +93,7 @@ public class TransportTest {
|
||||
opt.query = new HashMap<String, String>() {{
|
||||
put("transport", "websocket");
|
||||
}};
|
||||
opt.timestampRequests = false;
|
||||
WS ws = new WS(opt);
|
||||
assertThat(ws.uri(), is("ws://test/engine.io?transport=websocket"));
|
||||
}
|
||||
@@ -99,6 +104,7 @@ public class TransportTest {
|
||||
opt.path ="/engine.io";
|
||||
opt.hostname = "test";
|
||||
opt.secure = true;
|
||||
opt.timestampRequests = false;
|
||||
WS ws = new WS(opt);
|
||||
assertThat(ws.uri(), is("wss://test/engine.io"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user