Пример #1
0
        public override void AgentConnect(string name, string url, string password)
        {
            logger.Trace("AgentConnect");
            OnAgentConnectEvent(name, url, password);

            if (proxy != null)
            {
                AgentDisconnect();
            }

            if (url.EndsWith("/"))
            {
                url += "PeachAgent";
            }
            else
            {
                url += "/PeachAgent";
            }

            _url = url;

            CreateProxy();

            try
            {
                proxy.AgentConnect(null);
            }
            catch (Exception ex)
            {
                throw new PeachException("Error, unable to connect to remote agent '" + _url + "'.  " + ex.Message, ex);
            }
        }
Пример #2
0
        public override void IterationStarting(uint iterationCount, bool isReproduction)
        {
            logger.Trace("IterationStarting: {0}, {1}", iterationCount, isReproduction);

            OnIterationStartingEvent(iterationCount, isReproduction);

            if (_restartAgent)
            {
                _restartAgent = false;
            }

            try
            {
                bool connected = false;
                PerformRemoting(delegate() { connected = proxy.Connected; });
                if (connected)
                {
                    PerformRemoting(delegate() { proxy.IterationStarting(iterationCount, isReproduction); });
                    return;
                }
            }
            catch (SocketException)
            {
                logger.Debug("IterationStarting: Socket error, recreating proxy");

                proxy = (AgentServiceTcpRemote)Activator.GetObject(typeof(AgentServiceTcpRemote), _url);
                if (proxy == null)
                {
                    throw new PeachException("Error, unable to create proxy for remote agent '" + _url + "'.");
                }
            }

            proxy.AgentConnect(null);
            RecreateMonitors();
            proxy.SessionStarting();
            proxy.IterationStarting(iterationCount, isReproduction);
        }