private void StopTestSession(TestSessionInfo testSessionInfo)
        {
            Task.Run(() =>
            {
                var eventsHandler = new TestSessionEventsHandler(this.communicationManager);

                try
                {
                    var stopped = TestSessionPool.Instance.KillSession(testSessionInfo);

                    eventsHandler.HandleStopTestSessionComplete(testSessionInfo, stopped);
                }
                catch (Exception ex)
                {
                    EqtTrace.Error("DesignModeClient: Exception in StopTestSession: " + ex);

                    eventsHandler.HandleLogMessage(TestMessageLevel.Error, ex.ToString());
                    eventsHandler.HandleStopTestSessionComplete(testSessionInfo, false);
                }
            });
        }
        private void StartTestSession(StartTestSessionPayload payload, ITestRequestManager requestManager)
        {
            Task.Run(() =>
            {
                var eventsHandler = new TestSessionEventsHandler(this.communicationManager);

                try
                {
                    var customLauncher = payload.HasCustomHostLauncher
                        ? DesignModeTestHostLauncherFactory.GetCustomHostLauncherForTestRun(this, payload.IsDebuggingEnabled)
                        : null;

                    requestManager.ResetOptions();
                    requestManager.StartTestSession(payload, customLauncher, eventsHandler, this.protocolConfig);
                }
                catch (Exception ex)
                {
                    EqtTrace.Error("DesignModeClient: Exception in StartTestSession: " + ex);

                    eventsHandler.HandleLogMessage(TestMessageLevel.Error, ex.ToString());
                    eventsHandler.HandleStartTestSessionComplete(null);
                }
            });
        }