borrow test helpers verbatim from redis-rb, use try_encoding