### Question:
HeadAndTail { public static <U> Publisher<HeadAndTail<U>> createFrom(Publisher<U> publisher) { AtomicBoolean first = new AtomicBoolean(true); UnicastProcessor<U> tail = UnicastProcessor.create(); UnicastProcessor<HeadAndTail<U>> firstResult = UnicastProcessor.create(); return Flux.from(publisher) .doOnComplete(tail::onComplete) .doOnError(tail::onError) .flatMap( message -> { if (first.compareAndSet(true, false)) { firstResult.onNext(new HeadAndTail<>(message, tail)); firstResult.onComplete(); return firstResult; } else { tail.onNext(message); return Flux.empty(); } }); } private  HeadAndTail(T head, Publisher<T> tail); static Publisher<HeadAndTail<U>> createFrom(Publisher<U> publisher); T head(); Publisher<T> tail();  }### Answer:
@Test public void testWithUnicastWithHeadException() { Flux<Long> requests = UnicastProcessor.create(emitter -> emitter.error(new RuntimeException())); StepVerifier.create( Flux.from(HeadAndTail.createFrom(requests)) .flatMap( pair -> { fail("never"); return null; })) .expectError(RuntimeException.class); }