public ClientWebSocketTransportDuplexSessionChannel(HttpChannelFactory<IDuplexSessionChannel> channelFactory, ClientWebSocketFactory connectionFactory, EndpointAddress remoteAddresss, Uri via, ConnectionBufferPool bufferPool)
     : base(channelFactory, remoteAddresss, via, bufferPool)
 {
     Contract.Assert(channelFactory != null, "connection factory must be set");
     _channelFactory = channelFactory;
     _connectionFactory = connectionFactory;
 }
 public ClientWebSocketTransportDuplexSessionChannel(HttpChannelFactory <IDuplexSessionChannel> channelFactory, ClientWebSocketFactory connectionFactory, EndpointAddress remoteAddresss, Uri via)
     : base(channelFactory, remoteAddresss, via)
 {
     Contract.Assert(channelFactory != null, "connection factory must be set");
     _channelFactory    = channelFactory;
     _connectionFactory = connectionFactory;
 }
Beispiel #3
0
        internal HttpChannelFactory(HttpTransportBindingElement bindingElement, BindingContext context)
            : base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory())
        {
            // validate setting interactions
            if (bindingElement.TransferMode == TransferMode.Buffered)
            {
                if (bindingElement.MaxReceivedMessageSize > int.MaxValue)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                              new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize",
                                                              SR.MaxReceivedMessageSizeMustBeInIntegerRange));
                }

                if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement",
                                                                                 SR.MaxBufferSizeMustMatchMaxReceivedMessageSize);
                }
            }
            else
            {
                if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement",
                                                                                 SR.MaxBufferSizeMustNotExceedMaxReceivedMessageSize);
                }
            }

            if (TransferModeHelper.IsRequestStreamed(bindingElement.TransferMode) &&
                bindingElement.AuthenticationScheme != AuthenticationSchemes.Anonymous)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement",
                                                                             SR.HttpAuthDoesNotSupportRequestStreaming);
            }

            _allowCookies = bindingElement.AllowCookies;

            if (_allowCookies)
            {
                _httpCookieContainerManager = new HttpCookieContainerManager();
            }

            if (!bindingElement.AuthenticationScheme.IsSingleton())
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.Format(SR.HttpRequiresSingleAuthScheme,
                                                                                                bindingElement.AuthenticationScheme));
            }
            _authenticationScheme = bindingElement.AuthenticationScheme;
            _maxBufferSize        = bindingElement.MaxBufferSize;
            _transferMode         = bindingElement.TransferMode;
            _useDefaultWebProxy   = bindingElement.UseDefaultWebProxy;

            _channelCredentials   = context.BindingParameters.Find <SecurityCredentialsManager>();
            _securityCapabilities = bindingElement.GetProperty <ISecurityCapabilities>(context);

            _webSocketSettings = WebSocketHelper.GetRuntimeWebSocketSettings(bindingElement.WebSocketSettings);
            int webSocketBufferSize = WebSocketHelper.ComputeClientBufferSize(MaxReceivedMessageSize);

            _bufferPool               = new ConnectionBufferPool(webSocketBufferSize);
            _clientWebSocketFactory   = ClientWebSocketFactory.GetFactory();
            _webSocketSoapContentType = new Lazy <string>(() => MessageEncoderFactory.CreateSessionEncoder().ContentType, LazyThreadSafetyMode.ExecutionAndPublication);
        }
 public ClientWebSocketTransportDuplexSessionChannel(HttpChannelFactory<IDuplexSessionChannel> channelFactory, ClientWebSocketFactory connectionFactory, EndpointAddress remoteAddresss, Uri via, ConnectionBufferPool bufferPool)
     : base(channelFactory, remoteAddresss, via, bufferPool)
 {
     this.channelFactory = channelFactory;
     this.connectionFactory = connectionFactory;
 }
Beispiel #5
0
 public ClientWebSocketTransportDuplexSessionChannel(HttpChannelFactory <IDuplexSessionChannel> channelFactory, ClientWebSocketFactory connectionFactory, EndpointAddress remoteAddresss, Uri via, ConnectionBufferPool bufferPool)
     : base(channelFactory, remoteAddresss, via, bufferPool)
 {
     this.channelFactory    = channelFactory;
     this.connectionFactory = connectionFactory;
 }