Ejemplo n.º 1
0
        public void TestPassThroughOther()
        {
            EmbeddedChannel   ch     = new EmbeddedChannel(new Http2StreamFrameToHttpObjectCodec(true));
            IHttp2ResetFrame  reset  = new DefaultHttp2ResetFrame(Http2Error.NoError);
            IHttp2GoAwayFrame goaway = new DefaultHttp2GoAwayFrame(Http2Error.NoError);

            Assert.True(ch.WriteInbound(reset));
            Assert.True(ch.WriteInbound(goaway.Retain()));

            Assert.Equal(reset, ch.ReadInbound <IHttp2ResetFrame>());

            var frame = ch.ReadInbound <IHttp2GoAwayFrame>();

            try
            {
                Assert.Equal(goaway, frame);
                Assert.Null(ch.ReadInbound <object>());
                Assert.False(ch.Finish());
            }
            finally
            {
                goaway.Release();
                frame.Release();
            }
        }
Ejemplo n.º 2
0
        public void TestEqualOperation()
        {
            // in this case, 'goAwayFrame' and 'unknownFrame' will also have an EMPTY_BUFFER data
            // so we want to check that 'dflt' will not consider them equal.
            DefaultHttp2GoAwayFrame  goAwayFrame  = new DefaultHttp2GoAwayFrame(Http2Error.ProtocolError);
            DefaultHttp2UnknownFrame unknownFrame = new DefaultHttp2UnknownFrame(Http2FrameTypes.Headers, new Http2Flags(1));
            var dflt = new DefaultByteBufferHolder(Unpooled.Empty);

            try
            {
                // not using 'assertNotEquals' to be explicit about which object we are calling .equals() on
                Assert.False(dflt.Equals(goAwayFrame));
                Assert.False(dflt.Equals(unknownFrame));
            }
            finally
            {
                goAwayFrame.Release();
                unknownFrame.Release();
                dflt.Release();
            }
        }