@staticmethod
def GetConnector(api_version):
    if (api_version not in [1, 2]):
        raise ValueError('api_version may be 1 or 2 only')
    with _HTTP_ENDPOINTS_LOCK:
        if (api_version not in _HTTP_ENDPOINTS):
            port = portpicker.PickUnusedPort()
            logging.info('Picked free AdminUI port %d.', port)
            api_auth_manager.APIACLInit.InitApiAuthManager()
            trd = wsgiapp_testlib.ServerThread(port)
            trd.StartAndWaitUntilServing()
            _HTTP_ENDPOINTS[api_version] = ('http://localhost:%d' % port)
        return http_connector.HttpConnector(api_endpoint=_HTTP_ENDPOINTS[api_version])
@staticmethod
def GetConnector(api_version):
    if (api_version not in [1, 2]):
        raise ValueError('api_version may be 1 or 2 only')
    with _HTTP_ENDPOINTS_LOCK:
        if (api_version not in _HTTP_ENDPOINTS):
            port = portpicker.PickUnusedPort()
            logging.info('Picked free AdminUI port %d.', port)
            api_auth_manager.APIACLInit.InitApiAuthManager()
            trd = wsgiapp_testlib.ServerThread(port)
            trd.StartAndWaitUntilServing()
            _HTTP_ENDPOINTS[api_version] = ('http://localhost:%d' % port)
        return http_connector.HttpConnector(api_endpoint=_HTTP_ENDPOINTS[api_version])