@Override
    public void subscribe(final Subscriber<? super String> observer) {
      observer.onSubscribe(EmptySubscription.INSTANCE);
      t =
          new Thread(
              new Runnable() {

                @Override
                public void run() {
                  for (String s : valuesToReturn) {
                    if (s == null) {
                      System.out.println("throwing exception");
                      try {
                        Thread.sleep(100);
                      } catch (Throwable e) {

                      }
                      observer.onError(new NullPointerException());
                      return;
                    } else {
                      observer.onNext(s);
                    }
                  }
                  System.out.println("subscription complete");
                  observer.onComplete();
                }
              });
      t.start();
    }
    @Override
    public void subscribe(final Subscriber<? super String> observer) {
      observer.onSubscribe(EmptySubscription.INSTANCE);
      t =
          new Thread(
              new Runnable() {

                @Override
                public void run() {
                  observer.onNext("hello");
                  observer.onComplete();
                }
              });
      t.start();
    }
 @Override
 public void subscribe(Subscriber<? super String> observer) {
   observer.onSubscribe(EmptySubscription.INSTANCE);
   boolean errorThrown = false;
   for (String s : valuesToReturn) {
     if (s == null) {
       System.out.println("throwing exception");
       observer.onError(new NullPointerException());
       errorThrown = true;
       // purposefully not returning here so it will continue calling onNext
       // so that we also test that we handle bad sequences like this
     } else {
       observer.onNext(s);
     }
   }
   if (!errorThrown) {
     observer.onComplete();
   }
 }
    @Override
    public void subscribe(final Subscriber<? super String> observer) {
      observer.onSubscribe(EmptySubscription.INSTANCE);
      t =
          new Thread(
              new Runnable() {

                @Override
                public void run() {
                  try {
                    Thread.sleep(100);
                  } catch (InterruptedException e) {
                    observer.onError(e);
                  }
                  observer.onNext("hello");
                  observer.onComplete();
                }
              });
      t.start();
    }
 @Override
 public void subscribe(Subscriber<? super String> observer) {
   observer.onSubscribe(EmptySubscription.INSTANCE);
   observer.onNext("hello");
   observer.onComplete();
 }