Exemple #1
0
        public static TlsHandler AddTlsHandler(this IChannelPipeline pipeline, string host, RemoteCertificateValidationCallback remoteCertificateValidationCallback)
        {
            var tlsHandler = new TlsHandler(stream => new SslStream(stream, true, remoteCertificateValidationCallback), new ClientTlsSettings(host));

            pipeline.AddFirst(DotNettyHandlerNames.TLS, tlsHandler);

            return(tlsHandler);
        }
Exemple #2
0
 public static void AddToPipeline(IChannelPipeline cp)
 {
     lock (SyncRoot)
     {
         Guard.ArgumentNotNull(cp, nameof(cp));
         if (cp.Get(TimeoutHandler.Name) == null)
         {
             cp.AddFirst(TimeoutHandler.Name, new TimeoutHandler());
         }
     }
 }
Exemple #3
0
            public override Property Check(IChannelPipeline obj0, PipelineMutationModel obj1)
            {
                var pipeline        = obj0.AddFirst(Name, Handler);
                var embeddedChannel = obj0.Channel() as EmbeddedChannel;

                Contract.Assert(embeddedChannel != null);
                embeddedChannel.RunPendingTasks();      // force the pipeline to run all scheduled tasks
                var pFirst  = pipeline.Skip(1).First(); //bypass the head node
                var mFirst  = obj1.Head.Next.Handler;
                var pLength = pipeline.Count();
                var prop    = (pFirst == mFirst)
                              .Label($"Expected head of pipeline to be {mFirst}, was {pFirst}")
                              .And(() => pLength == obj1.Length)
                              .Label($"Expected length of pipeline to be {obj1.Length}, was {pLength}");

                // TODO: need some kind of "when" syntax for conditionally checking a property
                return(CheckEventInQueue(mFirst, SupportedEvent.HandlerAdded, prop, LastEventHistory(obj0)));
            }