assertThat(response.headers().get(UPGRADE), equalTo("websocket"));
assertThat(response.headers().get(CONTENT_LENGTH), is(nullValue()));
}
private static FullHttpRequest webSocketUpgradeRequest(final String path, final WebSocketVersion version) {
final FullHttpRequest req = new DefaultFullHttpRequest(HTTP_1_1, GET, path);
req.headers().set(HOST, "server.test.com");
req.headers().set(UPGRADE, WEBSOCKET.toString());
req.headers().set(CONNECTION, "Upgrade");
if (version == WebSocketVersion.V00) {
req.headers().set(CONNECTION, "Upgrade");
req.headers().set(SEC_WEBSOCKET_KEY1, "4 @1 46546xW%0l 1 5");
req.headers().set(SEC_WEBSOCKET_KEY2, "12998 5 Y3 1 .P00");
req.headers().set(ORIGIN, "http://example.com");
final ByteBuf byteBuf = Unpooled.copiedBuffer("^n:ds[4U", CharsetUtil.US_ASCII);
req.content().writeBytes(byteBuf);
byteBuf.release();
} else {
req.headers().set(SEC_WEBSOCKET_KEY, "dGhlIHNhbXBsZSBub25jZQ==");
req.headers().set(SEC_WEBSOCKET_ORIGIN, "http://test.com");
req.headers().set(SEC_WEBSOCKET_VERSION, version.toHttpHeaderValue());
}
return req;
}