@Test public void unwrap() { performer.onserver(new Action<ServerHttpExchange>() { @Override public void on(ServerHttpExchange http) { assertThat(http.unwrap(ChannelHandlerContext.class), instanceOf(ChannelHandlerContext.class)); assertThat(http.unwrap(HttpRequest.class), instanceOf(HttpRequest.class)); assertThat(http.unwrap(HttpResponse.class), instanceOf(HttpResponse.class)); performer.start(); } }) .send(); }
@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 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 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); }
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 String method(); @Override Set<String> headerNames(); @Override List<String> headers(String name); @Override T unwrap(Class<T> clazz); }
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 String method(); @Override Set<String> headerNames(); @Override List<String> headers(String name); @Override T unwrap(Class<T> clazz);  }