public void SendMessageAsyncCanBeCancelled()
        {
            var action  = "DoSomething";
            var request = new ServerRequest
            {
                ServerName = "TestServer"
            };
            var            url        = "http://nowhere";
            HttpConnection connection = null;
            var            factory    = new TestClientFactory((u, a, d) =>
            {
                connection.CancelAsync();
                return(new byte[0]);
            });

            connection = new HttpConnection(new Uri(url), factory);
            var completed = false;

            connection.SendMessageCompleted += (o, e) =>
            {
                completed = true;
                Assert.IsTrue(e.Cancelled);
                Assert.IsNull(e.Error);
                Assert.IsNull(e.Response);
            };
            connection.SendMessageAsync(action, request);
            Assert.IsTrue(completed);
        }