def _connect(self, hosts_list):
        """
        In the basic case, hostsp is a list of hosts like:

        ```
        [10.0.0.2:2181, 10.0.0.3:2181]
        ```

        It might also contain auth info:

        ```
        [digest:foo:bar@10.0.0.2:2181, 10.0.0.3:2181]
        ```
        """
        self._disconnect()
        auth_data = []
        hosts = []

        for auth_host in hosts_list:
            nl = Netloc.from_string(auth_host)
            rhost, rport = hosts_to_endpoints(nl.host)[0]
            if self._tunnel is not None:
                lhost, lport = TunnelHelper.create_tunnel(rhost, rport, self._tunnel)
                hosts.append('{0}:{1}'.format(lhost, lport))
            else:
                hosts.append(nl.host)

            if nl.scheme != "":
                auth_data.append((nl.scheme, nl.credential))

        self._zk = XClient(",".join(hosts),
                           read_only=self._read_only,
                           timeout=self._connect_timeout,
                           auth_data=auth_data if len(auth_data) > 0 else None)
        if self._asynchronous:
            self._connect_async(hosts)
        else:
            self._connect_sync(hosts)
def _connect ( self , hosts_list ) : self . _disconnect ( ) auth_data = [ ] hosts = [ ] for auth_host in hosts_list : nl = Netloc . from_string ( auth_host ) rhost , rport = hosts_to_endpoints ( nl . host ) [ 0 ] if self . _tunnel is not None : lhost , lport = TunnelHelper . create_tunnel ( rhost , rport , self . _tunnel ) hosts . append ( '{0}:{1}' . format ( lhost , lport ) ) else : hosts . append ( nl . host ) if nl . scheme != "" : auth_data . append ( ( nl . scheme , nl . credential ) ) self . _zk = XClient ( "," . join ( hosts ) , read_only = self . _read_only , timeout = self . _connect_timeout , auth_data = auth_data if len ( auth_data ) > 0 else None ) if self . _asynchronous : self . _connect_async ( hosts ) else : self . _connect_sync ( hosts )
In the basic case, hostsp is a list of hosts like:

        ```
        [10.0.0.2:2181, 10.0.0.3:2181]
        ```

        It might also contain auth info:

        ```
        [digest:foo:bar@10.0.0.2:2181, 10.0.0.3:2181]
        ```