def parse_addresses(addresses)
      return if addresses.empty?
      uris = addresses.is_a?(Array) ? addresses.dup : addresses.split(/[\s,]+/)
      uris.map! do |uri_string|
        begin
          uri = URI.parse(uri_string)
        rescue URI::InvalidURIError
          # IP based hosts without a scheme will fail to parse
        end
        if uri && uri.scheme && uri.host
          raise(InvalidURIScheme, "Invalid beanstalk URI: #{uri_string}") unless uri.scheme == 'beanstalk'
          host = uri.host
          port = uri.port
        else
          # if parse failure or missing scheme or host, assume the uri format is a
          # hostname optionally followed by a port.
          # i.e. 'localhost:11300' or '0.0.0.0'
          match = uri_string.split(/:/)
          host = match[0]
          port = match[1]
        end
        "#{host}:#{port || 11300}"
      end
    end
def parse_addresses(addresses)
      return if addresses.empty?
      uris = addresses.is_a?(Array) ? addresses.dup : addresses.split(/[\s,]+/)
      uris.map! do |uri_string|
        begin
          uri = URI.parse(uri_string)
        rescue URI::InvalidURIError
          # IP based hosts without a scheme will fail to parse
        end
        if uri && uri.scheme && uri.host
          raise(InvalidURIScheme, "Invalid beanstalk URI: #{uri_string}") unless uri.scheme == 'beanstalk'
          host = uri.host
          port = uri.port
        else
          # if parse failure or missing scheme or host, assume the uri format is a
          # hostname optionally followed by a port.
          # i.e. 'localhost:11300' or '0.0.0.0'
          match = uri_string.split(/:/)
          host = match[0]
          port = match[1]
        end
        "#{host}:#{port || 11300}"
      end
    end
:call-seq:
   parse_addresses(addresses) => String

 Parses the given urls into a collection of beanstalk addresses