public async Task when_sending_payload_with_identifier_then_does_not_receive_on_other_identifier()
        {
            var configuration = new MqttConfiguration();
            var stream        = new PrivateStream(configuration);

            var serverReceived = 0;
            var serverReceiver = stream
                                 .Receive(EndpointIdentifier.Server)
                                 .Subscribe(payload => {
                serverReceived++;
            });

            stream.Send(new byte[255], EndpointIdentifier.Client);
            stream.Send(new byte[100], EndpointIdentifier.Client);
            stream.Send(new byte[30], EndpointIdentifier.Client);

            await Task.Delay(TimeSpan.FromMilliseconds(1000));

            Assert.Equal(0, serverReceived);
        }
        public async Task when_sending_payload_with_identifier_then_does_not_receive_on_other_identifier()
        {
            MqttConfiguration configuration = new MqttConfiguration();
            PrivateStream     stream        = new PrivateStream(configuration);

            int         serverReceived = 0;
            IDisposable serverReceiver = stream
                                         .Receive(EndpointIdentifier.Server)
                                         .Subscribe(payload =>
            {
                serverReceived++;
            });

            stream.Send(new byte[255], EndpointIdentifier.Client);
            stream.Send(new byte[100], EndpointIdentifier.Client);
            stream.Send(new byte[30], EndpointIdentifier.Client);

            await Task.Delay(TimeSpan.FromMilliseconds(1000));

            0.Should().Be(serverReceived);
        }
        public async Task when_sending_to_stream_then_channel_receives_successfully()
        {
            var configuration = new MqttConfiguration();
            var stream        = new PrivateStream(configuration);
            var channel       = new PrivateChannel(stream, EndpointIdentifier.Server, configuration);

            var packetsReceived = 0;

            channel.ReceiverStream.Subscribe(packet => {
                packetsReceived++;
            });

            stream.Send(new byte[255], EndpointIdentifier.Client);
            stream.Send(new byte[10], EndpointIdentifier.Client);
            stream.Send(new byte[34], EndpointIdentifier.Client);
            stream.Send(new byte[100], EndpointIdentifier.Client);
            stream.Send(new byte[50], EndpointIdentifier.Client);

            await Task.Delay(TimeSpan.FromMilliseconds(1000));

            Assert.Equal(5, packetsReceived);
        }