@Test
public void testFailNextSource() throws IOException, RuntimeException,
    FlumeSpecException, InterruptedException {

  SourceFactoryImpl srcfact = new SourceFactoryImpl();
  srcfact.setSource("failNext", new SourceBuilder() {
    @Override
    public EventSource build(Context ctx, String... argv) {
      return new EventSource.Base() {
        @Override
        public Event next() throws IOException {
          LOG.info("in FailOpenSource.next");
          throw new IOException("next always fails");
        }
      };
    }
  });
  FlumeBuilder.setSourceFactory(srcfact);
  LogicalNode node = drive("failNext", "null");
  // Check that state is failed.
  assertEquals(DriverState.ERROR, node.getDriver().getState());
}