public static IApplication Connect(ConnectionSettings connectionSettings)
        {
            VerifyManagedConnector();
            if (!CheckConnection(connectionSettings))
            {
                throw new ApplicationStartupException(ErrorMessageFormatter.UnableToConnectToHostApplication());
            }
            IApplication application = ConnectInternal(connectionSettings);

            return(application);
        }
        private static void WaitForStartup(ConnectionSettings connectionSettings)
        {
            // checkPeriod (ms) * iterations = totally wait time (ms)
            // 200 (ms) * 20 = 4000 (ms) = 4 (sec)
            const int checkPeriod = 200;
            const int iterations  = 20;

            for (int i = 0; i < iterations; i++)
            {
                if (CheckConnection(connectionSettings))
                {
                    return;
                }
                Thread.Sleep(checkPeriod);
            }
            throw new ApplicationStartupException(ErrorMessageFormatter.UnableToConnectToHostApplication());
        }