public async Task TestHelloStream()
        {
            // Check we skip the first message with "hello" data
            var fakeHandler = new FakeHttpMessageHandler();
            var stream      = "event: open\ndata: hello\n\ndata: foobar\n\n";

            fakeHandler.QueueResponse(FakeResponse.StartsStream(StreamAction.Write(stream)));

            using (var eventSource = new SSEEventSource(_uri, builder => builder.MessageHandler(fakeHandler)))
            {
                string dataReceived = null;
                eventSource.Message += (sender, args) =>
                {
                    dataReceived = args.Data;
                    eventSource.Shutdown();
                };

                await eventSource.Connect();

                Assert.AreEqual("foobar", dataReceived);
            }
        }
        public async Task TestStream()
        {
            var json = File.ReadAllText(Path.Combine("testdata", "ledger.json"))
                       .Replace(Environment.NewLine, "");
            var fakeHandler = new FakeHttpMessageHandler();
            var stream      = $"event: open\ndata: hello\n\nid: 1234\ndata: {json}\n\n";

            fakeHandler.QueueResponse(FakeResponse.StartsStream(StreamAction.Write(stream)));

            var eventSource = new SSEEventSource(new Uri("http://test.com"),
                                                 builder => builder.MessageHandler(fakeHandler));

            LedgerResponse dataReceived = null;

            eventSource.Message += (sender, args) =>
            {
                dataReceived = JsonSingleton.GetInstance <LedgerResponse>(args.Data);
                eventSource.Shutdown();
            };

            await eventSource.Connect();

            LedgerDeserializeTest.AssertTestData(dataReceived);
        }