protected override Action Start(ClientAuthenticationValidator validator, EndpointAddress serviceAddress)
        {
            VtortConnectorServiceHost host = new VtortConnectorServiceHost(validator, serviceAddress.Uri);
            host.Open();

            return () => host.Close();
        }
        protected override void OnStart(string[] args)
        {
            try
            {
                ConnectorFramework connectorFramework = new ConnectorFramework();
                InitializeConnectors(connectorFramework.LocalManager);

                NameValueCollection settings = ConfigurationManager.AppSettings;

                String keyHash = settings.Get(PropKey);
                if (keyHash == null)
                {
                    throw new Org.IdentityConnectors.Framework.Common.Exceptions.ConfigurationException(
                        "Missing required configuration property: " + PropKey);
                }

                ClientAuthenticationValidator validator = new ClientAuthenticationValidator();
                validator.Add(new SingleTenantPrincipal(connectorFramework), keyHash);

                String facadeLifeTimeStr = settings.Get(PropFacadeLifetime);
                if (facadeLifeTimeStr != null)
                {
                    // _server.MaxFacadeLifeTime = Int32.Parse(facedeLifeTimeStr);
                }

                String disableWcf = settings.Get("disableWcf");
                OperatingSystem os = Environment.OSVersion;
                if (disableWcf == null && (os.Platform == PlatformID.Win32NT) &&
                    ((os.Version.Major > 6) || ((os.Version.Major == 6) && (os.Version.Minor >= 2))))
                {
                    ServiceHost host = new ConnectorServiceHost(validator);
                    host.Open();

                    _closeAction = () => host.Close();
                    Trace.TraceInformation("Started WCF connector server");
                }
                else
                {
                    Uri[] endpointUri = ExtractEndPoint();
                    if (endpointUri == null)
                    {
                        throw new Org.IdentityConnectors.Framework.Common.Exceptions.ConfigurationException(
                            "Missing required baseAddress");
                    }
                    VtortConnectorServiceHost host = new VtortConnectorServiceHost(validator, endpointUri);
                    host.Open();

                    _closeAction = () => host.Close();
                    Trace.TraceInformation("Started WebSocketListener connector server");
                }
            }
            catch (Exception e)
            {
                TraceUtil.TraceException("Exception occured starting connector server", e);
                throw;
            }
        }