public static async Task <QbservableProtocol> NegotiateServerAsync(Stream stream, IRemotingFormatter formatter, QbservableServiceOptions serviceOptions, CancellationToken cancel)
        {
            // TODO: Enable protocol registration and implement actual protocol negotiation

            var protocol = new DefaultQbservableProtocol(stream, formatter, serviceOptions, cancel);

            var buffer = new byte[4];

            await protocol.ReceiveAsync(buffer, 0, 4).ConfigureAwait(false);

            await protocol.SendAsync(buffer, 0, 4).ConfigureAwait(false);

            return(protocol);
        }
        public static async Task <QbservableProtocol> NegotiateClientAsync(Stream stream, IRemotingFormatter formatter, CancellationToken cancel)
        {
            // TODO: Enable protocol registration and implement actual protocol negotiation

            var protocol = new DefaultQbservableProtocol(stream, formatter, cancel);

            const int ping = 123;

            var buffer = BitConverter.GetBytes(ping);

            await protocol.SendAsync(buffer, 0, 4).ConfigureAwait(false);

            await protocol.ReceiveAsync(buffer, 0, 4).ConfigureAwait(false);

            Contract.Assume(BitConverter.ToInt32(buffer, 0) == ping);

            return(protocol);
        }