class EventMachine::Protocols::HttpClient2

def self.connect *args

:ssl => true to enable ssl
:port => a port number
:host => a hostname or ip-address
If the arguments are a hash, then supported values include:
a hostname/ip-address and a port), or a hash.
Can take either a pair of arguments (which will be interpreted as
Make a connection to a remote HTTP server.
def self.connect *args
  if args.length == 2
    args = {:host=>args[0], :port=>args[1]}
  else
    args = args.first
  end
  h,prt,ssl = args[:host], Integer(args[:port]), (args[:tls] || args[:ssl])
  conn = EM.connect( h, prt, self )
  conn.start_tls if ssl
  conn.set_default_host_header( h, prt, ssl )
  conn
end