Beispiel #1
0
 public ConnectivityModeConnectionInitiator(TokenProvider tokenProvider, SocketSecurityRole securityMode, int bufferSize, ConnectivityModeCache cache)
 {
     this.tokenProvider = tokenProvider;
     this.securityMode  = securityMode;
     this.bufferSize    = bufferSize;
     this.cache         = cache;
 }
Beispiel #2
0
        public ConnectivityModeConnectionElement(TokenProvider tokenProvider, SocketSecurityRole socketSecurityMode, BindingContext context, NameSettings nameSettings, ConnectivitySettings connectivitySettings, HttpConnectivitySettings httpConnectivitySettings)
        {
            this.tokenProvider = tokenProvider;
            this.SecurityMode  = socketSecurityMode;
            this.cache         = new ConnectivityModeCache(connectivitySettings, httpConnectivitySettings);
            if (context == null || !(context.ListenUriBaseAddress != null))
            {
                return;
            }
            InternalConnectivityMode internalConnectivityMode = this.cache.GetInternalConnectivityMode(context.ListenUriBaseAddress);

            switch (internalConnectivityMode)
            {
            case InternalConnectivityMode.Tcp:
            {
                this.connectionElement = new RelayedSocketElement(context, nameSettings, this.tokenProvider, this.SecurityMode);
                return;
            }

            case InternalConnectivityMode.Http:
            {
                this.connectionElement = new WebStreamRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings, false);
                return;
            }

            case InternalConnectivityMode.Https:
            {
                this.connectionElement = new WebStreamRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings, true);
                return;
            }

            case InternalConnectivityMode.HttpsWebSocket:
            {
                this.connectionElement = new WebSocketRelayedConnectionElement(this.tokenProvider, this.SecurityMode, context, nameSettings);
                return;
            }
            }
            throw new InvalidOperationException(SRClient.UnsupportedConnectivityMode(internalConnectivityMode));
        }