56: def initialize(host, options={})
57: self.logger = options[:logger]
58:
59: @host = host
60: @port = options[:port] || DEFAULT_PORT
61: @bind_address = options[:bind_address] || nil
62: @options = options
63:
64: debug { "establishing connection to #{@host}:#{@port}" }
65: factory = options[:proxy] || TCPSocket
66: @socket = timeout(options[:timeout] || 0) { @bind_address.nil? || options[:proxy] ? factory.open(@host, @port) : factory.open(@host,@port,@bind_address) }
67: @socket.extend(PacketStream)
68: @socket.logger = @logger
69:
70: debug { "connection established" }
71:
72: @queue = []
73:
74: @host_key_verifier = select_host_key_verifier(options[:paranoid])
75:
76:
77: @server_version = timeout(options[:timeout] || 0) { ServerVersion.new(socket, logger) }
78:
79: @algorithms = Algorithms.new(self, options)
80: wait { algorithms.initialized? }
81: end