public boolean didTimeout(long duration, TimeUnit unit) {
        if (completed) {
            return false;
        }
        return timeSinceLastLine(unit) > duration;
    }
@Test
    public void shouldKnowIfPumperExpired() throws Exception {
        PipedOutputStream output = new PipedOutputStream();
        try (output) {
            InputStream inputStream = new PipedInputStream(output);
            TestingClock clock = new TestingClock();
            StreamPumper pumper = new StreamPumper(inputStream, new TestConsumer(), "", StandardCharsets.UTF_8, clock);
            new Thread(pumper).start();

            output.write("line1\n".getBytes());
            output.flush();

            long timeoutDuration = 2L;
            assertThat(pumper.didTimeout(timeoutDuration, TimeUnit.SECONDS), is(false));
            clock.addSeconds(5);
            assertThat(pumper.didTimeout(timeoutDuration, TimeUnit.SECONDS), is(true));
        }
    }