Exemplo n.º 1
0
        public void Initialize()
        {
            var proxyService = new ProxyService();

            ServicesCollection.Current.RegisterInstance(proxyService);
            proxyService?.Start();
        }
        public void TestInitialize()
        {
            var chromeDriverService = ChromeDriverService.CreateDefaultService(_assemblyFolder);
            var chromeOptions       = new ChromeOptions();

            if (ConfigurationService.Instance.GetLoadTestingSettings().IsEnabled&&
                ConfigurationService.Instance.GetWebProxySettings().IsEnabled)
            {
                _proxyService = new ProxyService();
                _loadTestingWorkflowPluginContext        = new LoadTestingWorkflowPluginContext();
                _proxyService.ProxyServer.BeforeRequest +=
                    _loadTestingWorkflowPluginContext.OnRequestCaptureTrafficEventHandler;
                _proxyService.Start();
                var webDriverProxy = new Proxy
                {
                    HttpProxy = $"http://127.0.0.1:{_proxyService.Port}",
                    SslProxy  = $"http://127.0.0.1:{_proxyService.Port}",
                };
                chromeOptions.Proxy = webDriverProxy;
            }

            Driver = new DriverAdapter(new ChromeDriver(chromeDriverService, chromeOptions));

            InitializeLoadTestingEngine();
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            Telemetry.Instance.TrackTestExecution("Web");
            var proxyService = new ProxyService();

            ServicesCollection.Current.RegisterInstance(proxyService);
            proxyService?.Start();
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var config = new ConfigurationBuilder()
                         .AddJsonFile("settings.json", optional: true, reloadOnChange: true).Build();

            var proxySettings = config.Get <ProxySettings>();

            var wait = new ManualResetEvent(false);

            var proxy = new ProxyService(proxySettings)
            {
                Logger = new ProxyLogger(Console.Out)
            };

            proxy.Start();

            wait.WaitOne();
        }
Exemplo n.º 5
0
        internal static void RpcTest(ILog logger)
        {
            var loop = true;

            //var modem = new GsmModem(logger);
            //modem.Start();

            var proxy = new ProxyService(logger);

            proxy.Start();


            var server = new ControllerServer(logger, 3302);

            server.Start();



            proxy.AddService(new LocalRpcService());
            proxy.AddService(new IdentificationService());

            var plugin = new Plugin();

            plugin.AddService(new RemoteRpcService());
            plugin.Register("Dummy");


            plugin.Invoke("local.dummy.time");

            /*
             * proxy.Invoke(new JsonRequest(0, "local.dummy.time", null));
             * proxy.Invoke(new JsonRequest(0, "remote.dummy.time", null));
             *
             * proxy.Invoke(new JsonRequest("{\"id\":\"12345\",\"method\":\"smart.relay\",\"params\":{\"relayId\":0, \"feederId\":2, \"state\":true}}"));
             */

            var clientListner = new ServerConnection(logger, proxy, "127.0.0.1", 3300)
            {
                ReconnectionTimeout = new TimeSpan(0, 0, 5)
            };                                                                                                                        //, RequestGuardtime = new TimeSpan(0, 1, 0)};

            //var clientListner = new ServerConnection(logger, proxy, "92.63.81.70", 3300) { ReconnectionTimeout = new TimeSpan(0, 0, 5) };//, RequestGuardtime = new TimeSpan(0, 1, 0)};
            clientListner.Start();

            while (loop)
            {
                try
                {
                    // TODO
                    //server.Invoke("111", new JsonRequest(0, "local.dummy.time", null));

                    //Thread.Sleep(100);
                }
                catch (ThreadAbortException)
                {
                    server.Stop();

                    throw;
                }
                catch (Exception ex)
                {
                    if (!(ex is SocketException || ex is IOException || ex is InvalidOperationException))
                    {
                        logger.Warn("Unexpected exception " + ex.GetType() + " at ModuleThread " + ex.Message);
                    }
                }
            }

            plugin.Unregister();

            loop = true;
            while (loop)
            {
                // TODO
                //proxy.Invoke(new JsonRequest(0, "remote.dummy.time", null));
                Thread.Sleep(1000);
            }

            clientListner.Stop();
            proxy.Stop();
            proxy.Dispose();
            //modem.Stop();
        }