    # File lib/phusion_passenger/message_client.rb, line 39
            def initialize(username, password, address = "unix:#{Utils.passenger_tmpdir}/socket")
                    @socket = connect_to_server(address)
                    begin
                            @channel = MessageChannel.new(@socket)

                            result = @channel.read
                            if result.nil?
                                    raise EOFError
                            elsif result.size != 2 || result[0] != "version"
                                    raise IOError, "The message server didn't sent a valid version identifier"
                            elsif result[1] != "1"
                                    raise IOError, "Unsupported message server protocol version #{result[1]}"
                            end

                            @channel.write_scalar(username)
                            @channel.write_scalar(password)

                            result = @channel.read
                            if result.nil?
                                    raise EOFError
                            elsif result[0] != "ok"
                                    raise SecurityError, result[0]
                            end
                    rescue Exception
                            @socket.close
                            raise
                    end
            end