コード例 #1
0
 public CloseNoOpServerProtocolHandler(WebSocketHandshakeHandOverTest owner, string websocketPath)
     : base(WebSocketServerProtocolConfig.NewBuilder()
            .WebsocketPath(websocketPath)
            .AllowExtensions(false)
            .SendCloseFrame(null)
            .Build())
 {
     _owner = owner;
 }
コード例 #2
0
        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));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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>());
        }