@Override
    public URL select(List<URL> urls, String serviceId, String tag, String requestKey) {
        String key = tag == null ? serviceId : serviceId + "|" + tag;
    	// search for a URL in the same ip first
        List<URL> localUrls = searchLocalUrls(urls, ip);
        if(localUrls.size() > 0) {
             if(localUrls.size() == 1) {
                 return localUrls.get(0);
             } else {
                // round robin within localUrls
                 return doSelect(localUrls, key);
             }
        } else {
            // round robin within urls
            return doSelect(urls, key);
        }
    }
@Ignore
    @Test
    public void testSelect() throws Exception {
        List<URL> urls = new ArrayList<>();
        urls.add(new URLImpl("http", "127.0.0.10", 8081, "v1", new HashMap<String, String>()));
        urls.add(new URLImpl("http", "127.0.0.1", 8081, "v1", new HashMap<String, String>()));
        urls.add(new URLImpl("http", "127.0.0.11", 8082, "v1", new HashMap<String, String>()));
        urls.add(new URLImpl("http", "127.0.0.12", 8083, "v1", new HashMap<String, String>()));
        urls.add(new URLImpl("http", "127.0.0.115", 8084, "v1", new HashMap<String, String>()));
        URL url = loadBalance.select(urls, "serviceId", "tag", null);
        Assert.assertEquals(url, URLImpl.valueOf("http://127.0.0.1:8081/v1"));
    }