```ruby
begin
  listing = service_directory.lookup(service)
  host = listing.try(:address) || options[:host]
  port = listing.try(:port) || options[:port]
end until host_alive?(host)
```