create a new connection when path is the same

This commit is contained in:
nkzawa
2016-01-31 17:33:28 +09:00
parent d538a9d117
commit f7810c19d3
4 changed files with 38 additions and 4 deletions

View File

@@ -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>();