public CloseNoOpServerProtocolHandler(WebSocketHandshakeHandOverTest owner, string websocketPath) : base(WebSocketServerProtocolConfig.NewBuilder() .WebsocketPath(websocketPath) .AllowExtensions(false) .SendCloseFrame(null) .Build()) { _owner = owner; }
EmbeddedChannel CreateChannel(IChannelHandler handler) { WebSocketServerProtocolConfig serverConfig = WebSocketServerProtocolConfig.NewBuilder() .WebsocketPath("/test") .SendCloseFrame(null) .Build(); return(new EmbeddedChannel( new WebSocketServerProtocolHandler(serverConfig), new HttpRequestDecoder(), new HttpResponseEncoder(), new MockOutboundHandler(this), handler)); }
private EmbeddedChannel CreateServer(params IChannelHandler[] handlers) { WebSocketServerProtocolConfig serverConfig = WebSocketServerProtocolConfig.NewBuilder() .WebsocketPath("/test") .DropPongFrames(false) .Build(); EmbeddedChannel ch = new EmbeddedChannel(false, false, new HttpServerCodec(), new HttpObjectAggregator(8192), new WebSocketServerProtocolHandler(serverConfig) ); ch.Pipeline.AddLast(handlers); ch.Register(); return(ch); }
public void DoNotCreateUTF8Validator() { var config = WebSocketServerProtocolConfig.NewBuilder() .WebsocketPath("/test") .WithUTF8Validator(false) .Build(); EmbeddedChannel ch = new EmbeddedChannel( new WebSocketServerProtocolHandler(config), new HttpRequestDecoder(), new HttpResponseEncoder(), new MockOutboundHandler(this)); WriteUpgradeRequest(ch); IFullHttpResponse response = _responses.Dequeue(); Assert.Equal(HttpResponseStatus.SwitchingProtocols, response.Status); response.Release(); Assert.Null(ch.Pipeline.Get <Utf8FrameValidator>()); }