/// <summary>
        /// Creates a <see cref="WSTrustChannel" /> that is used to send messages to a service at a specific
        /// endpoint address through a specified transport address.
        /// </summary>
        /// <param name="address">The <see cref="EndpointAddress" /> that provides the location of the service.</param>
        /// <param name="via">The <see cref="Uri" /> that contains the transport address to which the channel sends messages.</param>
        /// <returns></returns>
        public override IWSTrustChannelContract CreateChannel(EndpointAddress address, Uri via)
        {
            IWSTrustChannelContract innerChannel = base.CreateChannel(address, via);

            WSTrustChannelLockedProperties lockedProperties = GetLockedProperties();

            return(CreateTrustChannel(innerChannel,
                                      lockedProperties.TrustVersion,
                                      lockedProperties.Context,
                                      lockedProperties.RequestSerializer,
                                      lockedProperties.ResponseSerializer));
        }
        private WSTrustChannelLockedProperties GetLockedProperties()
        {
            lock (_factoryLock)
            {
                if (_lockedProperties == null)
                {
                    WSTrustChannelLockedProperties tmpLockedProperties = new WSTrustChannelLockedProperties();
                    tmpLockedProperties.TrustVersion       = GetTrustVersion();
                    tmpLockedProperties.Context            = CreateSerializationContext();
                    tmpLockedProperties.RequestSerializer  = GetRequestSerializer(tmpLockedProperties.TrustVersion);
                    tmpLockedProperties.ResponseSerializer = GetResponseSerializer(tmpLockedProperties.TrustVersion);

                    _lockedProperties = tmpLockedProperties;
                    _locked           = true;
                }
                return(_lockedProperties);
            }
        }