void Microsoft.ServiceBus.IDirectConnectionParent.Failure(object sender, Exception exception)
        {
            DirectConnectionCandidateManager.Candidate candidate = (DirectConnectionCandidateManager.Candidate)sender;
            bool flag = false;

            lock (this.ThisLock)
            {
                this.candidates.Remove(candidate);
                candidate.Dispose();
                if (this.refCount == 0 && this.candidates.Count == 0 && !this.complete)
                {
                    if (!this.complete)
                    {
                        this.complete = true;
                        flag          = true;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            if (flag)
            {
                this.Failure(this, new Exception("Connect failed"));
            }
        }
        void Microsoft.ServiceBus.IDirectConnectionParent.Success(object sender, Socket socket)
        {
            DirectConnectionCandidateManager.Candidate candidate = (DirectConnectionCandidateManager.Candidate)sender;
            bool flag = false;

            lock (this.ThisLock)
            {
                this.candidates.Remove(candidate);
                candidate.Dispose();
                if (!this.complete)
                {
                    this.complete = true;
                    flag          = true;
                }
                else
                {
                    socket.Close();
                    return;
                }
            }
            if (flag)
            {
                this.parent.Success(this, socket);
            }
        }