NettyServerHttpExchange extends AbstractServerHttpExchange { @Override public <T> T unwrap(Class<T> clazz) { return ChannelHandlerContext.class.isAssignableFrom(clazz) ? clazz.cast(context) : HttpRequest.class.isAssignableFrom(clazz) ? clazz.cast(request) : HttpResponse.class.isAssignableFrom(clazz) ? clazz.cast(response) : null; } NettyServerHttpExchange(ChannelHandlerContext context, HttpRequest request); @Override String uri(); @Override HttpMethod method(); @Override Set<String> headerNames(); @Override List<String> headers(String name); @Override T unwrap(Class<T> clazz);  }
@Test public void unwrap() throws Throwable { requestAction(http -> { threadAssertTrue(http.unwrap(ChannelHandlerContext.class) instanceof ChannelHandlerContext); threadAssertTrue(http.unwrap(HttpRequest.class) instanceof HttpRequest); threadAssertTrue(http.unwrap(HttpResponse.class) instanceof HttpResponse); resume(); }); client.newRequest(uri()).send(new Response.Listener.Adapter()); await(); }