Ejemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            warmup();
            var unsecure = chkUnsecureEcho.Checked;

            Text        = "Working...";
            tbNote.Text = "Started...";
            var w = Stopwatch.StartNew();

            var client = new JokeContractClient(cbo.Text);

            client.DispatchTimeoutMs = 5 * 1000;
            client.TimeoutMs         = 40 * 1000;
            if (!unsecure && chkImpersonate.Checked)
            {
                client.Headers.Add(new AuthenticationHeader(new IDPasswordCredentials(tbID.Text, tbPwd.Text)));
            }

            var totalCalls = tbCallsPerReactor.Text.AsInt();

            System.Threading.Tasks.Parallel.For(0, totalCalls,
                                                (i) =>
            {
                client.Async_Notify("aa");
            });
            var allFinished = w.ElapsedMilliseconds;

            Text = "Placed {0:n2} One Way calls in {1:n2} ms,  @ {2:n2} calls/sec "
                   .Args
                   (
                totalCalls,
                allFinished,
                totalCalls / (allFinished / 1000d)
                   );
        }