JerseyEventSink extends ChunkedOutput<OutboundSseEvent> implements SseEventSink, Flushable, Flow.Subscriber<OutboundSseEvent> { @Override public void onError(final Throwable throwable) { checkClosed(); if (throwable == null) { throw new NullPointerException(LocalizationMessages.PARAM_NULL("throwable")); } subscription.cancel(); } JerseyEventSink(Provider<AsyncContext> asyncContextProvider); @Override void onSubscribe(final Flow.Subscription subscription); @Override void onNext(final OutboundSseEvent item); @Override void onError(final Throwable throwable); @Override void close(); @Override CompletionStage<?> send(OutboundSseEvent event); @Override void flush(); void onComplete();  }
@Test public void onError() throws Exception { JerseyEventSink eventSink = new JerseyEventSink(null); eventSink.close(); thrown.expect(IllegalStateException.class); eventSink.onError(null); }