コード例 #1
0
 // For testing only.
 internal Http2FrameCodecBuilder FrameWriter(IHttp2FrameWriter frameWriter)
 {
     if (frameWriter is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.frameWriter);
     }
     _frameWriter = frameWriter;
     return(this);
 }
コード例 #2
0
        public DecoratingHttp2FrameWriter(IHttp2FrameWriter writer)
        {
            if (writer is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.writer);
            }

            _innerWriter = writer;
        }
コード例 #3
0
 public IHttp2LocalFlowController FrameWriter(IHttp2FrameWriter frameWriter)
 {
     if (frameWriter is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.frameWriter);
     }
     _frameWriter = frameWriter;
     return(this);
 }
コード例 #4
0
 public Http2OutboundFrameLogger(IHttp2FrameWriter writer, IHttp2FrameLogger logger)
 {
     if (writer is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.writer);
     }
     if (logger is null)
     {
         ThrowHelper.ThrowArgumentNullException(ExceptionArgument.logger);
     }
     _writer = writer;
     _logger = logger;
 }
コード例 #5
0
 /// <summary>
 /// Write headers via <see cref="IHttp2FrameWriter"/>. If <paramref name="hasPriority"/> is <c>false</c> it will ignore the
 /// <paramref name="streamDependency"/>, <paramref name="weight"/> and <paramref name="exclusive"/> parameters.
 /// </summary>
 private static Task SendHeadersAsync(IHttp2FrameWriter frameWriter,
                                      IChannelHandlerContext ctx, int streamId,
                                      IHttp2Headers headers, bool hasPriority,
                                      int streamDependency, short weight,
                                      bool exclusive, int padding,
                                      bool endOfStream, IPromise promise)
 {
     if (hasPriority)
     {
         return(frameWriter.WriteHeadersAsync(ctx, streamId, headers, streamDependency,
                                              weight, exclusive, padding, endOfStream, promise));
     }
     return(frameWriter.WriteHeadersAsync(ctx, streamId, headers, padding, endOfStream, promise));
 }
コード例 #6
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()));
        }
コード例 #7
0
        public DefaultHttp2ConnectionEncoder(IHttp2Connection connection, IHttp2FrameWriter frameWriter)
        {
            if (connection is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.connection);
            }
            if (frameWriter is null)
            {
                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.frameWriter);
            }
            _connection  = connection;
            _frameWriter = frameWriter;
            var connRemote = connection.Remote;

            if (connRemote.FlowController is null)
            {
                connRemote.FlowController = new DefaultHttp2RemoteFlowController(connection);
            }
        }
コード例 #8
0
 public Http2OutputProducer(int streamId, IHttp2FrameWriter frameWriter)
 {
     _streamId    = streamId;
     _frameWriter = frameWriter;
 }
コード例 #9
0
 public IHttp2LocalFlowController FrameWriter(IHttp2FrameWriter frameWriter)
 {
     return(_flowController.FrameWriter(frameWriter));
 }
コード例 #10
0
 public Http2FrameInboundWriter(EmbeddedChannel channel, IHttp2FrameWriter writer)
 {
     _ctx    = new WriteInboundChannelHandlerContext(channel);
     _writer = writer;
 }
コード例 #11
0
 protected override Http2FrameCodec NewCodec(TestChannelInitializer childChannelInitializer, IHttp2FrameWriter frameWriter)
 {
     return(new Http2MultiplexCodecBuilder(true, childChannelInitializer).FrameWriter(frameWriter).Build());
 }