HttClientTest cleanup
This commit is contained in:
Greg Wilkins 2016-03-16 19:28:25 +11:00
parent ca5bedb97f
commit 5da034db66
1 changed files with 20 additions and 16 deletions

View File

@ -86,6 +86,7 @@ import org.eclipse.jetty.util.FuturePromise;
import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.Promise;
import org.eclipse.jetty.util.SocketAddressResolver; import org.eclipse.jetty.util.SocketAddressResolver;
import org.eclipse.jetty.util.log.StacklessLogging;
import org.eclipse.jetty.util.ssl.SslContextFactory; import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Assume; import org.junit.Assume;
@ -481,24 +482,27 @@ public class HttpClientTest extends AbstractHttpClientServerTest
client.setMaxConnectionsPerDestination(1); client.setMaxConnectionsPerDestination(1);
final CountDownLatch latch = new CountDownLatch(2); try (StacklessLogging stackless = new StacklessLogging(org.eclipse.jetty.server.HttpChannel.class))
client.newRequest("localhost", connector.getLocalPort()) {
.scheme(scheme) final CountDownLatch latch = new CountDownLatch(2);
.path("/one") client.newRequest("localhost", connector.getLocalPort())
.onResponseFailure((response, failure) -> latch.countDown()) .scheme(scheme)
.send(null); .path("/one")
.onResponseFailure((response, failure) -> latch.countDown())
.send(null);
client.newRequest("localhost", connector.getLocalPort()) client.newRequest("localhost", connector.getLocalPort())
.scheme(scheme) .scheme(scheme)
.path("/two") .path("/two")
.onResponseSuccess(response -> .onResponseSuccess(response ->
{ {
Assert.assertEquals(200, response.getStatus()); Assert.assertEquals(200, response.getStatus());
latch.countDown(); latch.countDown();
}) })
.send(null); .send(null);
Assert.assertTrue(latch.await(5, TimeUnit.SECONDS)); Assert.assertTrue(latch.await(5, TimeUnit.SECONDS));
}
} }
@Test @Test