public static async Task <byte[]> ReadAllToArrayWithTimeout(
            this IReadableByteStream stream)
        {
            var readTask    = stream.ReadAllToArray();
            var timeoutTask = Task.Delay(ReadTimeout);
            var combined    = Task.WhenAny(new Task[] { readTask, timeoutTask });
            var done        = await combined;

            if (done == readTask)
            {
                return(readTask.Result);
            }
            throw new TimeoutException();
        }