Source:
<code>public void testConcurrentStreamCreation() throws Exception { int threads = 64; int runs = 1; int iterations = 1024; int total = threads * runs * iterations; CountDownLatch serverLatch = new CountDownLatch(total); start(new ServerSessionListener.Adapter() { @Override public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) { MetaData.Response response = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields()); HeadersFrame responseFrame = new HeadersFrame(stream.getId(), response, null, true); stream.headers(responseFrame, Callback.NOOP); serverLatch.countDown(); return null; } }, h2 -> h2.setMaxConcurrentStreams(total)); Session session = newClient(new Session.Listener.Adapter()); CyclicBarrier barrier = new CyclicBarrier(threads); CountDownLatch clientLatch = new CountDownLatch(total); Promise<Stream> promise = new Promise.Adapter<Stream>() { @Override public void succeeded(Stream stream) { clientLatch.countDown(); } }; long start = System.nanoTime(); IntStream.range(0, threads).forEach(i -> new Thread(() -> { try { barrier.await(); IntStream.range(0, runs).forEach(j -> IntStream.range(0, iterations).forEach(k -> { MetaData.Request request = newRequest("GET", new HttpFields()); HeadersFrame requestFrame = new HeadersFrame(request, null, true); session.newStream(requestFrame, promise, new Stream.Listener.Adapter()); })); } catch (Throwable x) { x.printStackTrace(); } }).start()); assertTrue(clientLatch.await(total, TimeUnit.MILLISECONDS), String.format("Missing streams on client: %d/%d", clientLatch.getCount(), total)); long elapsed = System.nanoTime() - start; <START> System.err.println("elapsed = " + elapsed); <END> assertTrue(serverLatch.await(total, TimeUnit.MILLISECONDS), String.format("Missing streams on server: %d/%d", serverLatch.getCount(), total)); }</code><technical_language>Remove System.err</technical_language>

Target:
public void testConcurrentStreamCreation() throws Exception { int threads = 64; int runs = 1; int iterations = 1024; int total = threads * runs * iterations; CountDownLatch serverLatch = new CountDownLatch(total); start(new ServerSessionListener.Adapter() { @Override public Stream.Listener onNewStream(Stream stream, HeadersFrame frame) { MetaData.Response response = new MetaData.Response(HttpVersion.HTTP_2, HttpStatus.OK_200, new HttpFields()); HeadersFrame responseFrame = new HeadersFrame(stream.getId(), response, null, true); stream.headers(responseFrame, Callback.NOOP); serverLatch.countDown(); return null; } }, h2 -> h2.setMaxConcurrentStreams(total)); Session session = newClient(new Session.Listener.Adapter()); CyclicBarrier barrier = new CyclicBarrier(threads); CountDownLatch clientLatch = new CountDownLatch(total); CountDownLatch responseLatch = new CountDownLatch(runs); Promise<Stream> promise = new Promise.Adapter<Stream>() { @Override public void succeeded(Stream stream) { clientLatch.countDown(); } }; IntStream.range(0, threads).forEach(i -> new Thread(() -> { try { barrier.await(); IntStream.range(0, runs).forEach(j -> IntStream.range(0, iterations).forEach(k -> { MetaData.Request request = newRequest("GET", new HttpFields()); HeadersFrame requestFrame = new HeadersFrame(request, null, true); session.newStream(requestFrame, promise, new Stream.Listener.Adapter() { @Override public void onHeaders(Stream stream, HeadersFrame frame) { int status = ((MetaData.Response)frame.getMetaData()).getStatus(); if (status == HttpStatus.OK_200 && frame.isEndStream()) responseLatch.countDown(); } }); })); } catch (Throwable x) { x.printStackTrace(); } }).start()); assertTrue(clientLatch.await(total, TimeUnit.MILLISECONDS), String.format("Missing streams on client: %d/%d", clientLatch.getCount(), total)); assertTrue(serverLatch.await(total, TimeUnit.MILLISECONDS), String.format("Missing streams on server: %d/%d", serverLatch.getCount(), total)); assertTrue(responseLatch.await(total, TimeUnit.MILLISECONDS), String.format("Missing response on client: %d/%d", clientLatch.getCount(), total)); }