# File lib/active_ldap/connection.rb, line 212
    def connection
      conn = @connection
      return conn if conn

      if @dn or
          (attribute_name_resolvable_without_connection? and
           get_attribute_before_type_cast(dn_attribute)[1])
        conn = self.class.active_connections[dn] || retrieve_connection
      end
      conn || self.class.connection
    end