/// <summary>
        /// Starts a new <see cref="Thread"/>, will poll the Stackdriver Debugger API for new
        /// breakpoints and reports them to the debugger via a <see cref="NamedPipeServer"/>.
        /// </summary>
        /// <returns>A task representing the asynchronous operation which will be completed when the
        /// named pipe server is connected.</returns>
        public Task StartWriteLoopAsync(CancellationToken cancellationToken)
        {
            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();

            new Thread(() =>
            {
                var breakpointServer = new BreakpointServer(new NamedPipeServer(_debuggerOptions.PipeName));
                using (var server = new BreakpointWriteActionServer(breakpointServer, _cts, _debuggerClient, _breakpointManager))
                {
                    TryAction(() =>
                    {
                        server.WaitForConnection();
                        tcs.SetResult(true);
                        server.StartActionLoop(TimeSpan.Zero, cancellationToken);
                    });

                    // TODO(talarico): Temporary solution: This will ensure the debugger shuts down. See #146.
                    var breakpoint = new Breakpoint {
                        KillServer = true
                    };
                    breakpointServer.WriteBreakpointAsync(breakpoint).Wait();
                }
            }).Start();
            return(tcs.Task);
        }
        /// <summary>
        /// Starts a new <see cref="Thread"/>>, will poll the debugger (via a <see cref="NamedPipeServer"/>)
        /// for hit breakpoints and reports them to the Stackdriver Debugger API.
        /// </summary>
        /// <returns>A task representing the asynchronous operation which will be completed when the
        /// named pipe server is connected.</returns>
        public Task StartReadLoopAsync(CancellationToken cancellationToken)
        {
            TaskCompletionSource <bool> tcs = new TaskCompletionSource <bool>();

            new Thread(() =>
            {
                var breakpointServer = new BreakpointServer(new NamedPipeServer(_debuggerOptions.PipeName));
                using (var server = new BreakpointReadActionServer(breakpointServer, _cts, _client, _breakpointManager))
                {
                    TryAction(() =>
                    {
                        server.WaitForConnection();
                        tcs.SetResult(true);
                        server.StartActionLoop(TimeSpan.Zero, cancellationToken);
                    });
                }
            }).Start();
            return(tcs.Task);
        }