public bool Handle(HostArguments args, HandleAsWindowsService service)
            {
                if (_shouldHandleAsWindowsService)
                {
                    _consoleWriterQueue.Enqueue("WindowsService.Starting");

                    using (service.OnStartFactory())
                    {
                        // simulates that windows service is started
                        _consoleWriterQueue.Enqueue("WindowsService.Running");

                        // Block - simulates that windows service is running
                        Thread.Sleep(10);

                        // Simulates that Windows Service is shutting down
                        _consoleWriterQueue.Enqueue("WindowsService.Stopping");
                    }

                    _consoleWriterQueue.Enqueue("WindowsService.Stopped");

                    return(true);
                }

                _consoleWriterQueue.Enqueue("NotWindowsService");
                return(false);
            }
            public void Handle(HostArguments args)
            {
                _consoleWriterQueue.Enqueue("Host.Handling");

                if (!_shouldHandleAsWindowsService)
                {
                    _consoleWriterQueue.Enqueue("Host.ManuallyRelease");
                    _waitBlock.Release();
                }

                _shutdown.WaitForShutdown();

                _consoleWriterQueue.Enqueue("Host.Handled");
            }