public void drainHandler(final Runnable handler) {
    checkContext();
    if (drainHandler != null) {
      throw new IllegalStateException("drainHandler already set");
    }
    this.drainHandler = Objects.requireNonNull(handler);
  }
@Test
  public void shouldNotAllowSettingDrainHandlerMoreThanOnce() throws Exception {
    CountDownLatch latch = new CountDownLatch(1);
    context.runOnContext(v -> {
      getBufferedPublisher().drainHandler(() -> {
      });
      try {
        getBufferedPublisher().drainHandler(() -> {
        });
        fail("Should throw exception");
      } catch (IllegalStateException e) {
        // OK
        latch.countDown();
      }
    });
    awaitLatch(latch);
  }