@SuppressWarnings("unchecked")
    @Test
    void testAsyncRenderingDoesNotHoldThreads() {
        // Set up
        ProcessorLibrary.FutureDataSource futureDataSource = new ProcessorLibrary.FutureDataSource();
        // Add some sync data as well to cause rendering to start before async data is added.
        // This allows us to wait on return data rather than having to wait for the 100 requests
        // to be done, which is cumbersome.
        Chain<Processor> chain = new Chain<>("main", new ProcessorLibrary.Federator(new Chain<Processor>(new ProcessorLibrary.DataSource()), new Chain<Processor>(futureDataSource)));
        driver = new ProcessingTestDriver(chain);

        int requestCount = 1000;
        ProcessingTestDriver.MockResponseHandler[] responseHandler = new ProcessingTestDriver.MockResponseHandler[requestCount];
        for (int i = 0; i < requestCount; i++) {
            responseHandler[i] = driver.sendRequest("http://localhost/?chain=main");
            assertEquals("{\"datalist\":[{\"datalist\":[{\"data\":\"first.null\"},{\"data\":\"second.null\"},{\"data\":\"third.null\"}]}",
                    responseHandler[i].read(),
                    "Sync data is available");
        }
        assertEquals(requestCount, futureDataSource.incomingData.size(), "All requests was processed");

        // Complete all
        for (int i = 0; i < requestCount; i++) {
            futureDataSource.incomingData.get(i).add(new ProcessorLibrary.StringData(null, "d1"));
            assertEquals(",{\"datalist\":[{\"data\":\"d1\"}", responseHandler[i].read());
            futureDataSource.incomingData.get(i).addLast(new ProcessorLibrary.StringData(null, "d2"));
            assertEquals(",{\"data\":\"d2\"}]}", responseHandler[i].read());
            assertEquals("]}", responseHandler[i].read());
            assertNull(responseHandler[i].read(), "Transmission completed");
        }
    }
Tests that the ResponseStatus takes precedence over errors
container-core/src/test/java/com/yahoo/processing/handler/ProcessingHandlerTestCase.java