示例#1
0
        public Http2FrameRoundtripTest()
        {
            this.alloc = new Mock <IByteBufferAllocator>();
            this.alloc.Setup(x => x.Buffer()).Returns(() => Unpooled.Buffer());
            this.alloc.Setup(x => x.Buffer(It.IsAny <int>())).Returns <int>(c => Unpooled.Buffer(c));
            this.channel  = new Mock <IChannel>();
            this.executor = new Mock <IEventExecutor>();
            this.listener = new Mock <IHttp2FrameListener>();
            this.ctx      = new Mock <IChannelHandlerContext>();
            this.ctx.Setup(x => x.Allocator).Returns(this.alloc.Object);
            this.ctx.Setup(x => x.Executor).Returns(this.executor.Object);
            this.ctx.Setup(x => x.Channel).Returns(this.channel.Object);
            this.ctx.Setup(x => x.NewPromise()).Returns(() => new DefaultPromise());

            this.writer = new DefaultHttp2FrameWriter(new DefaultHttp2HeadersEncoder(NeverSensitiveDetector.Instance, Http2TestUtil.NewTestEncoder()));
            this.reader = new DefaultHttp2FrameReader(new DefaultHttp2HeadersDecoder(false, Http2TestUtil.NewTestDecoder()));
        }