NettyServerWebSocket extends AbstractServerWebSocket { @Override public <T> T unwrap(Class<T> clazz) { return ChannelHandlerContext.class.isAssignableFrom(clazz) ? clazz.cast(context) : WebSocketServerHandshaker.class.isAssignableFrom(clazz) ? clazz.cast(handshaker) : FullHttpRequest.class.isAssignableFrom(clazz) ? clazz.cast(request) : null; } NettyServerWebSocket(ChannelHandlerContext context, FullHttpRequest req,
                              WebSocketServerHandshaker handshaker); @Override String uri(); @Override Set<String> headerNames(); @Override List<String> headers(String name); @Override T unwrap(Class<T> clazz);  }
@Test public void unwrap() throws Throwable { websocketAction(ws -> { threadAssertTrue(ws.unwrap(ChannelHandlerContext.class) instanceof ChannelHandlerContext); threadAssertTrue(ws.unwrap(WebSocketServerHandshaker.class) instanceof WebSocketServerHandshaker); threadAssertTrue(ws.unwrap(FullHttpRequest.class) instanceof FullHttpRequest); resume(); }); client.connect(new WebSocketAdapter(), URI.create(uri())); await(); }