@SuppressWarnings({"unchecked"})
    @Test
    void testFutureDataPassThrough() throws InterruptedException, ExecutionException, TimeoutException {
        // Set up
        FutureDataSource futureDataSource = new FutureDataSource();
        Chain<Processor> chain = new Chain<>(new DataCounter(), futureDataSource);

        // Execute
        Request request = new Request();
        Response response = Execution.createRoot(chain, 0, Execution.Environment.createEmpty()).process(request); // Urk ...

        // Verify the result prior to completion of delayed data
        assertEquals(1, response.data().asList().size());
        assertEquals("Data count: 0", response.data().get(0).toString());

        // complete delayed data
        assertEquals(1, futureDataSource.incomingData.size(), "Delayed data was requested once");
        futureDataSource.incomingData.get(0).add(new StringData(request, "d1"));
        futureDataSource.incomingData.get(0).addLast(new StringData(request, "d2"));
        assertEquals(1, response.data().asList().size(), "New data is not visible because we haven't asked for it");
        response.data().completeFuture().get(1000, TimeUnit.MILLISECONDS);
        assertEquals(3, response.data().asList().size(), "Now the data is available");
        assertEquals("d1", response.data().get(1).toString().toString());
        assertEquals("d2", response.data().get(2).toString().toString());
    }
Run a chain which ends in a processor which returns a response containing future data.
container-core/src/test/java/com/yahoo/processing/execution/test/FutureDataTestCase.java