protected Thread runInThread(final StreamProcessor processor, CountDownLatch stopStartLatch) {
    Thread t = new Thread() {

      @Override
      public void run() {
        LOG.info("about to start processor " + processor);
        processor.start();
        LOG.info("started processor " + processor);
        try {
          // just wait
          if (!stopStartLatch.await(1000000, TimeUnit.MILLISECONDS)) {
            LOG.warn("Wait timed out for processor " + processor);
            Assert.fail("Wait timed out for processor " + processor);
          }
          LOG.info("notified. Abandon the wait for processor " + processor);
        } catch (InterruptedException e) {
          LOG.error("wait interrupted" + e);
        }
        LOG.info("Stopping the processor" + processor);
        processor.stop();
        LOG.info("Stopped the processor" + processor);
      }
    };
    return t;
  }
Runs the provided stream processor by starting it, waiting on the provided latch with a timeout,
and then stopping it.
samza-test/src/test/java/org/apache/samza/processor/TestZkStreamProcessorBase.java