create a new connection when path is the same
This commit is contained in:
@@ -81,8 +81,16 @@ public abstract class Connection {
|
||||
return client(createOptions());
|
||||
}
|
||||
|
||||
Socket client(String path) throws URISyntaxException {
|
||||
return IO.socket(path, createOptions());
|
||||
}
|
||||
|
||||
Socket client(IO.Options opts) throws URISyntaxException {
|
||||
return IO.socket(uri() + nsp(), opts);
|
||||
return client(nsp(), opts);
|
||||
}
|
||||
|
||||
Socket client(String path, IO.Options opts) throws URISyntaxException {
|
||||
return IO.socket(uri() + path, opts);
|
||||
}
|
||||
|
||||
String uri() {
|
||||
|
||||
@@ -19,6 +19,8 @@ import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
@RunWith(JUnit4.class)
|
||||
@@ -47,6 +49,26 @@ public class ConnectionTest extends Connection {
|
||||
socket.close();
|
||||
}
|
||||
|
||||
@Test(timeout = TIMEOUT)
|
||||
public void startTwoConnectionsWithSamePath() throws URISyntaxException, InterruptedException {
|
||||
Socket s1 = client("/");
|
||||
Socket s2 = client("/");
|
||||
|
||||
assertThat(s1.io(), not(equalTo(s2.io())));
|
||||
s1.close();
|
||||
s2.close();
|
||||
}
|
||||
|
||||
@Test(timeout = TIMEOUT)
|
||||
public void startTwoConnectionsWithSamePathAndDifferentQuerystrings() throws URISyntaxException, InterruptedException {
|
||||
Socket s1 = client("/?woot");
|
||||
Socket s2 = client("/");
|
||||
|
||||
assertThat(s1.io(), not(equalTo(s2.io())));
|
||||
s1.close();
|
||||
s2.close();
|
||||
}
|
||||
|
||||
@Test(timeout = TIMEOUT)
|
||||
public void workWithAcks() throws URISyntaxException, InterruptedException {
|
||||
final BlockingQueue<Object> values = new LinkedBlockingQueue<Object>();
|
||||
|
||||
Reference in New Issue
Block a user