public static void ClientProc(object stateInfo)
        {
            Contract.Requires(null != stateInfo);
            var taskInfo = stateInfo as ClientInfo;

            Contract.Assert(null != taskInfo);

            var sw = Stopwatch.StartNew();

            using (var client = new NamedPipeClientStream(taskInfo.Server, taskInfo.PipeName, PipeDirection.Out))
            {
                client.Connect(taskInfo.DurationMs);
                client.ReadMode = PipeTransmissionMode.Message;
                var pipeHandler = new PipeHandler(client);

                var randomString = MessageFactory.Get();
                do
                {
                    var message = string.Format
                                  (
                        "Source: '{0}', DateTimeOffset '{1}', Message '{2}'",
                        taskInfo.SourceName, DateTimeOffset.Now.ToString("O"), randomString
                                  );
                    pipeHandler.Send(message);
                }while (taskInfo.DurationMs > sw.ElapsedMilliseconds);
            }

            return;
        }
        public static void ServerProc(object stateInfo)
        {
            Contract.Requires(null != stateInfo);
            var serverInfo = stateInfo as ServerInfo;

            Contract.Assert(null != serverInfo);

            var server = serverInfo.Instance;

            Contract.Assert(null != server);

            try
            {
                server.WaitForConnection();
                var pipeHandler = new PipeHandler(server);

                var sw = Stopwatch.StartNew();
                do
                {
                    if (!server.IsConnected)
                    {
                        return;
                    }

                    var message = pipeHandler.Read();
                    if (message.StartsWith("Source: 'Source-0"))
                    {
                        _source0 = true;
                    }
                    else if (message.StartsWith("Source: 'Source-1"))
                    {
                        _source1 = true;
                    }
                    else if (message.StartsWith("Source: 'Source-2"))
                    {
                        _source2 = true;
                    }
                    else if (message.StartsWith("Source: 'Source-3"))
                    {
                        _source3 = true;
                    }
                    else
                    {
                        _sourceOther = true;
                    }
                }while (serverInfo.DurationMs > sw.ElapsedMilliseconds);
            }
            finally
            {
                server.Dispose();

                lock (_lock)
                {
                    _serverConnections.Remove(server);
                }
            }
        }