public static async Task <object> ReadResponseAsync(this RedisConnection connection)
        {
            object result;

            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            ReadResult input = await connection.Input.ReadAsync();

            ReadableBuffer buffer = input.Buffer;


            var leadByte = buffer.First.Span[0];

            buffer = buffer.Slice(1);
            switch (leadByte)
            {
            case RedisProtocol.SimpleStringStart:
                result = buffer.ReadSimpleStringAsync();
                break;

            case RedisProtocol.ErrorStart:
                result = buffer.ReadErrorStringAsync();
                break;

            case RedisProtocol.NumberStart:
                result = buffer.ReadLongAsync();
                break;

            case RedisProtocol.BulkStringStart:
                result = buffer.ReadBulkStringAsync();
                break;

            case RedisProtocol.ArrayStart:
                result = buffer.ReadArrayAsync();
                break;

            default:
                result = new RedisErrorString("Invalid response initial character " + (char)leadByte);
                break;
            }

            return(result);
        }