### Question:
WritableBodyPublisher implements BodyPublisher, Flushable, AutoCloseable { public void closeExceptionally(Throwable error) { requireNonNull(error); if (!closed) { closed = true; closeError = error; SubscriptionImpl subscription = downstreamSubscription; if (subscription != null) { subscription.signalError(error); } } } private  WritableBodyPublisher(); WritableByteChannel byteChannel(); OutputStream outputStream(); void closeExceptionally(Throwable error); @Override void close(); @Override void flush(); @Override long contentLength(); @Override void subscribe(Subscriber<? super ByteBuffer> subscriber); static WritableBodyPublisher create();  }### Answer:
@Test void closeExceptionally() throws IOException { var body = WritableBodyPublisher.create(); try (var out = body.outputStream()) { out.write(new byte[] {'a', 'b', 'c'}); out.flush(); body.closeExceptionally(new TestException()); } var subscriber = new TestSubscriber() { Throwable error; @Override public void onError(Throwable t) { this.error = t; } }; body.subscribe(subscriber); assertNotNull(subscriber.error); assertEquals(TestException.class, subscriber.error.getClass()); }