Ejemplo n.º 1
0
        protected void CreateProxy()
        {
            RemoveProxy();

            IDictionary props = new Hashtable() as IDictionary;

            props["port"]              = 0;
            props["timeout"]           = (uint)1000 * 60 * 1; // wait one minute max
            props["connectionTimeout"] = (uint)1000 * 60 * 1; // wait one minute max

#if !MONO
            if (RemotingConfiguration.CustomErrorsMode != CustomErrorsModes.Off)
            {
                RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off;
            }
#endif

            BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();

            _channel = new TcpClientChannel(props, clientProvider);
            ChannelServices.RegisterChannel(_channel, false);             // Disable security for speed

            proxy = (AgentServiceTcpRemote)Activator.GetObject(typeof(AgentServiceTcpRemote), _url);
            if (proxy == null)
            {
                throw new PeachException("Error, unable to create proxy for remote agent '" + _url + "'.");
            }
        }
Ejemplo n.º 2
0
        protected void RemoveProxy()
        {
            proxy = null;

            if (_channel != null)
            {
                ChannelServices.UnregisterChannel(_channel);
                _channel = null;
            }
        }
Ejemplo n.º 3
0
        protected void CreateProxy()
        {
            RemoveProxy();

            IDictionary props = new Hashtable() as IDictionary;

            props["timeout"]           = (uint)1000 * 60 * 1; // wait one minute max
            props["connectionTimeout"] = (uint)1000 * 60 * 1; // wait one minute max

            _channel = new TcpClientChannel(props, null);
            ChannelServices.RegisterChannel(_channel, false);             // Disable security for speed

            proxy = (AgentServiceTcpRemote)Activator.GetObject(typeof(AgentServiceTcpRemote), _url);
            if (proxy == null)
            {
                throw new PeachException("Error, unable to create proxy for remote agent '" + _url + "'.");
            }
        }
Ejemplo n.º 4
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);
        }