protected override TChannel OnCreateChannel(EndpointAddress address, Uri via)
        {
            LateBoundChannelParameterCollection channelParameters = new LateBoundChannelParameterCollection();

            IClientReliableChannelBinder binder = ClientReliableChannelBinder <InnerChannel> .CreateBinder(address, via,
                                                                                                           this.InnerChannelFactory, MaskingMode.All,
                                                                                                           TolerateFaultsMode.IfNotSecuritySession, channelParameters, this.DefaultCloseTimeout,
                                                                                                           this.DefaultSendTimeout);

            if (typeof(TChannel) == typeof(IOutputSessionChannel))
            {
                if (typeof(InnerChannel) == typeof(IDuplexChannel) || typeof(InnerChannel) == typeof(IDuplexSessionChannel))
                {
                    return((TChannel)(object)new ReliableOutputSessionChannelOverDuplex(this, this, binder, this.faultHelper, channelParameters));
                }

                // typeof(InnerChannel) == typeof(IRequestChannel) || typeof(InnerChannel) == typeof(IRequestSessionChannel))
                return((TChannel)(object)new ReliableOutputSessionChannelOverRequest(this, this, binder, this.faultHelper, channelParameters));
            }
            else if (typeof(TChannel) == typeof(IDuplexSessionChannel))
            {
                return((TChannel)(object)new ClientReliableDuplexSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId()));
            }

            // (typeof(TChannel) == typeof(IRequestSessionChannel)
            return((TChannel)(object)new ReliableRequestSessionChannel(this, this, binder, this.faultHelper, channelParameters, WsrmUtilities.NextSequenceId()));
        }
        public IAsyncResult BeginRequest(Message message, TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state)
        {
            ClientReliableChannelBinder <TChannel> .RequestAsyncResult requestAsyncResult = new ClientReliableChannelBinder <TChannel> .RequestAsyncResult(this, callback, state);

            requestAsyncResult.Start(message, timeout, maskingMode);
            return((IAsyncResult)requestAsyncResult);
        }
 protected override IAsyncResult BeginOutput(
     ClientReliableChannelBinder <TChannel> binder, TChannel channel, Message message,
     TimeSpan timeout, MaskingMode maskingMode, AsyncCallback callback, object state)
 {
     return(binder.OnBeginRequest(channel, message, timeout, maskingMode, callback,
                                  state));
 }
 protected override void EndOutput(ClientReliableChannelBinder <TChannel> binder, TChannel channel, MaskingMode maskingMode, IAsyncResult result)
 {
     this.reply = binder.OnEndRequest(channel, maskingMode, result);
 }
 public RequestAsyncResult(ClientReliableChannelBinder <TChannel> binder, AsyncCallback callback, object state) : base(binder, callback, state)
 {
 }