public void readToEnd() {
   while (!completed) {
     try {
       clock.sleepForMillis(100);
     } catch (InterruptedException ignored) {
     }
   }
 }
 private Long timeSinceLastLine(TimeUnit unit) {
   long now = clock.currentTimeMillis();
   return unit.convert(now - lastHeard, TimeUnit.MILLISECONDS);
 }