Port recent client/transport refactoring to the Ruby version.