@Test public void testDuplicateWebsocketHandshakeHeaders() { URI uri = URI.create("ws: HttpHeaders inputHeaders = new DefaultHttpHeaders(); String bogusSubProtocol = "bogusSubProtocol"; String bogusHeaderValue = "bogusHeaderValue"; for (CharSequence header : getHandshakeHeaderNames()) { inputHeaders.add(header, bogusHeaderValue); } inputHeaders.add(getProtocolHeaderName(), bogusSubProtocol); String realSubProtocol = "realSubProtocol"; WebSocketClientHandshaker handshaker = newHandshaker(uri, realSubProtocol, inputHeaders); FullHttpRequest request = handshaker.newHandshakeRequest(); HttpHeaders outputHeaders = request.headers(); for (CharSequence header : getHandshakeHeaderNames()) { assertEquals(1, outputHeaders.getAll(header).size()); assertNotEquals(bogusHeaderValue, outputHeaders.get(header)); } assertEquals(1, outputHeaders.getAll(getProtocolHeaderName()).size()); assertEquals(realSubProtocol, outputHeaders.get(getProtocolHeaderName())); request.release(); }
protected abstract FullHttpRequest newHandshakeRequest();
WebSocketClientHandshaker { protected abstract FullHttpRequest newHandshakeRequest(); }
WebSocketClientHandshaker { protected abstract FullHttpRequest newHandshakeRequest(); protected  WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol,
                                        HttpHeaders customHeaders, int maxFramePayloadLength); }
WebSocketClientHandshaker { protected abstract FullHttpRequest newHandshakeRequest(); protected  WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol,
                                        HttpHeaders customHeaders, int maxFramePayloadLength); URI uri(); WebSocketVersion version(); int maxFramePayloadLength(); boolean isHandshakeComplete(); String expectedSubprotocol(); String actualSubprotocol(); ChannelFuture handshake(Channel channel); final ChannelFuture handshake(Channel channel, final ChannelPromise promise); final void finishHandshake(Channel channel, FullHttpResponse response); final ChannelFuture processHandshake(final Channel channel, HttpResponse response); final ChannelFuture processHandshake(final Channel channel, HttpResponse response,
                                                final ChannelPromise promise); ChannelFuture close(Channel channel, CloseWebSocketFrame frame); ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise); }
WebSocketClientHandshaker { protected abstract FullHttpRequest newHandshakeRequest(); protected  WebSocketClientHandshaker(URI uri, WebSocketVersion version, String subprotocol,
                                        HttpHeaders customHeaders, int maxFramePayloadLength); URI uri(); WebSocketVersion version(); int maxFramePayloadLength(); boolean isHandshakeComplete(); String expectedSubprotocol(); String actualSubprotocol(); ChannelFuture handshake(Channel channel); final ChannelFuture handshake(Channel channel, final ChannelPromise promise); final void finishHandshake(Channel channel, FullHttpResponse response); final ChannelFuture processHandshake(final Channel channel, HttpResponse response); final ChannelFuture processHandshake(final Channel channel, HttpResponse response,
                                                final ChannelPromise promise); ChannelFuture close(Channel channel, CloseWebSocketFrame frame); ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise);  }