Exemple #1
0
        public NiftyClient(NettyClientConfig nettyClientConfig, ILoggerFactory loggerFactorty = null)
        {
            Guard.ArgumentNotNull(nettyClientConfig, nameof(nettyClientConfig));
            this.NettyClientConfig = nettyClientConfig;

            this._timer                   = nettyClientConfig.Timer;
            this.WorkerExecutor           = nettyClientConfig.WorkerExecutor;
            this.DefaultSocksProxyAddress = nettyClientConfig.DefaultSocksProxyAddress;
            this._allChannel              = new DefaultChannelGroup(null);
            _logger = loggerFactorty?.CreateLogger <NiftyClient>() ?? (ILogger)NullLogger.Instance;
        }
Exemple #2
0
 protected abstract void OnConfigureChannelPipeline(IChannelPipeline pipeline, int maxFrameSize, NettyClientConfig clientConfig);
Exemple #3
0
 public abstract T NewThriftClientChannel(IChannel channel, NettyClientConfig clientConfig);
Exemple #4
0
        public void ConfigureChannelPipeline(IChannelPipeline pipeline, int maxFrameSize, NettyClientConfig clientConfig, ClientSslConfig sslConfig)
        {
            if (sslConfig != null)
            {
                RemoteCertificateValidationCallback validationCallback = sslConfig.ValidateServerCertificate;

                pipeline.AddLast("tls",
                                 new TlsHandler(stream => new SslStream(stream, true, validationCallback),
                                                new ClientTlsSettings(this.ServerAddress.GetHost())));
            }
            this.OnConfigureChannelPipeline(pipeline, maxFrameSize, clientConfig);
        }
        public override UnframedClientChannel NewThriftClientChannel(IChannel nettyChannel, NettyClientConfig clientConfig)
        {
            UnframedClientChannel channel = new UnframedClientChannel(nettyChannel, clientConfig.Timer, this.ProtocolFactory);
            var cp = nettyChannel.Pipeline;

            TimeoutHandler.AddToPipeline(cp);
            cp.AddLast("thriftHandler", channel);
            return(channel);
        }
 protected override void OnConfigureChannelPipeline(IChannelPipeline pipeline, int maxFrameSize, NettyClientConfig clientConfig)
 {
     TimeoutHandler.AddToPipeline(pipeline);
     pipeline.AddLast("thriftUnframedDecoder", new ThriftUnframedDecoder());
     //if (clientConfig.sslClientConfiguration() != null)
     //{
     //    pipeline.addFirst("ssl", clientConfig.sslClientConfiguration().createHandler(address));
     //}
 }
Exemple #7
0
 protected override void OnConfigureChannelPipeline(IChannelPipeline pipeline, int maxFrameSize, NettyClientConfig clientConfig)
 {
     pipeline.AddLast("frameEncoder", new LengthFieldPrepender(LengthFieldLength));
     pipeline.AddLast(
         "frameDecoder",
         new LengthFieldBasedFrameDecoder(
             maxFrameSize,
             LengthFieldOffset,
             LengthFieldLength,
             LengthAdjustment,
             InitialBytesToStrip));
     //if (clientConfig.sslClientConfiguration() != null)
     //{
     //    pipeline.AddFirst("ssl", clientConfig.sslClientConfiguration().createHandler(address));
     //}
 }