HttpResponseException extends RuntimeException { public HttpResponse httpResponse() { return httpResponse; } private  HttpResponseException(HttpResponse httpResponse); static HttpResponseException of(int statusCode); static HttpResponseException of(HttpStatus httpStatus); static HttpResponseException of(AggregatedHttpResponse aggregatedResponse); static HttpResponseException of(HttpResponse httpResponse); HttpResponse httpResponse(); @Override Throwable fillInStackTrace();  }
@Test void testHttpResponse() throws Exception { final HttpResponseWriter response = HttpResponse.streaming(); final HttpResponseException exception = HttpResponseException.of(response); response.write(ResponseHeaders.of(HttpStatus.INTERNAL_SERVER_ERROR, HttpHeaderNames.CONTENT_TYPE, MediaType.PLAIN_TEXT_UTF_8)); response.close(); final AggregatedHttpResponse message = exception.httpResponse().aggregate().join(); assertThat(message.status()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); assertThat(message.contentType()).isEqualTo(MediaType.PLAIN_TEXT_UTF_8); }