@Test
    @Timeout(10000)
    public void testRedirectionOfStreams() throws Exception {
        //test redirection of system.err to system.out
        Path outputDir = getNewOutputDir("noisy_parsers");

        Map<String, String> args = getDefaultArgs("noisy_parsers", outputDir);
        args.put("numConsumers", "1");
        args.put("maxAliveTimeSeconds", "20");//main process loop should stop after 5 seconds
        String stderr = "writing something to System.err";
        BatchProcessTestExecutor ex = new BatchProcessTestExecutor(args);
        StreamStrings streamStrings = ex.execute();
        assertEquals(1, countChildren(outputDir));
        assertContains("System.out", streamStrings.getOutString());
        assertContains(stderr, streamStrings.getOutString());
        assertNotContained(stderr, streamStrings.getErrString());
    }
This tests to make sure that BatchProcess waits the appropriate
amount of time on an early termination before stopping.
<p>
If this fails, then interruptible parsers (e.g. those with
nio channels) will be interrupted and there will be corrupted data.
tika-batch/src/test/java/org/apache/tika/batch/fs/BatchProcessTest.java