Merged branch 'jetty-9.3.x' into 'jetty-9.4.x'.

This commit is contained in:
Simone Bordet 2016-08-14 23:29:36 +02:00
commit 13f638f710
1 changed files with 12 additions and 7 deletions

View File

@ -52,7 +52,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
@Test
public void testOneConcurrentStream() throws Exception
{
long sleep = 2000;
long sleep = 1000;
start(1, new AbstractHandler()
{
@Override
@ -65,8 +65,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
});
client.setMaxConnectionsPerDestination(1);
// Prime the connection so that the maxConcurrentStream setting arrives to the client.
client.newRequest("localhost", connector.getLocalPort()).path("/prime").send();
primeConnection();
CountDownLatch latch = new CountDownLatch(2);
@ -108,8 +107,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
});
client.setMaxConnectionsPerDestination(1);
// Prime the connection so that the maxConcurrentStream setting arrives to the client.
client.newRequest("localhost", connector.getLocalPort()).path("/prime").send();
primeConnection();
// Send requests up to the max allowed.
for (int i = 0; i < maxStreams; ++i)
@ -153,8 +151,7 @@ public class MaxConcurrentStreamsTest extends AbstractTest
});
client.setMaxConnectionsPerDestination(1);
// Prime the connection so that the maxConcurrentStream setting arrives to the client.
client.newRequest("localhost", connector.getLocalPort()).path("/prime").send();
primeConnection();
// Send a request that is aborted while queued.
client.newRequest("localhost", connector.getLocalPort())
@ -197,6 +194,14 @@ public class MaxConcurrentStreamsTest extends AbstractTest
Assert.assertTrue(latch.await(maxConcurrent * sleep / 2, TimeUnit.MILLISECONDS));
}
private void primeConnection() throws Exception
{
// Prime the connection so that the maxConcurrentStream setting arrives to the client.
client.newRequest("localhost", connector.getLocalPort()).path("/prime").send();
// Wait for the server to clean up and remove the stream that primes the connection.
sleep(1000);
}
private void sleep(long time)
{
try