Example #1
0
 public RelayedSocketListener(TokenProvider tokenProvider, NameSettings nameSettings, SocketSecurityRole socketSecurityMode, ConnectivitySettingsEndpointBehavior connectivitySettings)
 {
     this.tokenProvider      = tokenProvider;
     this.nameSettings       = nameSettings;
     this.socketSecurityMode = socketSecurityMode;
     this.serviceHost        = new ConfigurationlessServiceHost(this, new Uri[0]);
     this.connectionSessions = new Dictionary <string, RelayedConnectionSession>();
     this.socketQueue        = new InputQueue <Microsoft.ServiceBus.Channels.IConnection>();
     this.mutex = new object();
     this.innerConnectionStatus        = new ConnectionStatusBehavior();
     this.connectivitySettingsBehavior = connectivitySettings;
 }
Example #2
0
        public RelayedSocketElement(BindingContext context, NameSettings nameSettings, TokenProvider tokenProvider, SocketSecurityRole socketSecurityMode)
        {
            this.context            = context;
            this.nameSettings       = nameSettings;
            this.tokenProvider      = tokenProvider;
            this.socketSecurityMode = socketSecurityMode;
            ConnectivitySettingsEndpointBehavior connectivitySettingsEndpointBehavior = null;
            ConnectivitySettings     connectivitySetting     = this.context.BindingParameters.Find <ConnectivitySettings>();
            HttpConnectivitySettings httpConnectivitySetting = this.context.BindingParameters.Find <HttpConnectivitySettings>();

            if (connectivitySetting != null || httpConnectivitySetting != null)
            {
                connectivitySettingsEndpointBehavior = new ConnectivitySettingsEndpointBehavior(connectivitySetting, httpConnectivitySetting);
            }
            this.connectionListener = new RelayedSocketListener(this.tokenProvider, this.nameSettings, this.socketSecurityMode, connectivitySettingsEndpointBehavior);
        }
Example #3
0
        public void Initialize(Uri uri, int bufferSize, Binding innerBinding)
        {
            this.uri        = uri;
            this.bufferSize = bufferSize;
            ServiceEndpoint serviceEndpoint = this.serviceHost.AddServiceEndpoint(typeof(IRelayedConnectionControl), innerBinding, uri);

            serviceEndpoint.Behaviors.Add(this.nameSettings);
            TransportClientEndpointBehavior transportClientEndpointBehavior = new TransportClientEndpointBehavior(this.tokenProvider);

            serviceEndpoint.Behaviors.Add(transportClientEndpointBehavior);
            serviceEndpoint.Behaviors.Add(this.innerConnectionStatus);
            if (this.connectivitySettings != null || this.httpConnectivitySettings != null)
            {
                ConnectivitySettingsEndpointBehavior connectivitySettingsEndpointBehavior = new ConnectivitySettingsEndpointBehavior(this.connectivitySettings, this.httpConnectivitySettings);
                serviceEndpoint.Behaviors.Add(connectivitySettingsEndpointBehavior);
            }
            ServiceErrorHandlerBehavior serviceErrorHandlerBehavior = new ServiceErrorHandlerBehavior();

            serviceErrorHandlerBehavior.HandleError += new EventHandler <ServiceErrorEventArgs>((object s, ServiceErrorEventArgs e) => Fx.Exception.TraceHandled(e.Exception, "WebStreamRelayedConnectionListener.IErrorHandler.HandleError", null));
            this.serviceHost.Description.Behaviors.Add(serviceErrorHandlerBehavior);
            this.messageHelper = new SocketMessageHelper();
        }