public static List<Endpoint> getConsoleServerList() {
        String config = SentinelConfig.getConfig(CONSOLE_SERVER);
        List<Endpoint> list = new ArrayList<Endpoint>();
        if (StringUtil.isBlank(config)) {
            return list;
        }

        int pos = -1;
        int cur = 0;
        while (true) {
            pos = config.indexOf(',', cur);
            if (cur < config.length() - 1 && pos < 0) {
                // for single segment, pos move to the end
                pos = config.length();
            }
            if (pos < 0) {
                break;
            }
            if (pos <= cur) {
                cur ++;
                continue;
            }
            // parsing
            String ipPortStr = config.substring(cur, pos);
            cur = pos + 1;
            if (StringUtil.isBlank(ipPortStr)) {
                continue;
            }
            ipPortStr = ipPortStr.trim();
            int port = 80;
            Protocol protocol = Protocol.HTTP;
            if (ipPortStr.startsWith("http://")) {
                ipPortStr = ipPortStr.substring(7);
            } else if (ipPortStr.startsWith("https://")) {
                ipPortStr = ipPortStr.substring(8);
                port = 443;
                protocol = Protocol.HTTPS;
            }
            int index = ipPortStr.indexOf(":");
            if (index == 0) {
                // skip
                continue;
            }
            String host = ipPortStr;
            if (index >= 0) {
                try {
                    port = Integer.parseInt(ipPortStr.substring(index + 1));
                    if (port <= 1 || port >= 65535) {
                        throw new RuntimeException("Port number [" + port + "] over range");
                    }
                } catch (Exception e) {
                    RecordLog.warn("Parse port of dashboard server failed: " + ipPortStr, e);
                    // skip
                    continue;
                }
                host = ipPortStr.substring(0, index);
            }
            list.add(new Endpoint(protocol, host, port));
        }
        return list;
    }
@Test
    public void testGetConsoleServerList() {
        // empty
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "");
        List<Endpoint> list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        // single ip
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "112.13.223.3");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(1, list.size());
        assertEquals("112.13.223.3", list.get(0).getHost());
        assertEquals(80, list.get(0).getPort());

        // single domain
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(1, list.size());
        assertEquals("www.dashboard.org", list.get(0).getHost());
        assertEquals(80, list.get(0).getPort());
        
        // single ip including port
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:81");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(1, list.size());
        assertEquals("www.dashboard.org", list.get(0).getHost());
        assertEquals(81, list.get(0).getPort());
        
        // mixed
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:81,112.13.223.3,112.13.223.4:8080,www.dashboard.org");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(4, list.size());
        assertEquals("www.dashboard.org", list.get(0).getHost());
        assertEquals(81, list.get(0).getPort());
        assertEquals("112.13.223.3", list.get(1).getHost());
        assertEquals(80, list.get(1).getPort());
        assertEquals("112.13.223.4", list.get(2).getHost());
        assertEquals(8080, list.get(2).getPort());
        assertEquals("www.dashboard.org", list.get(3).getHost());
        assertEquals(80, list.get(3).getPort());
        
        // malformed
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:0");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:-1");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, ":80");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:80000");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(0, list.size());
        
        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "www.dashboard.org:80000,www.dashboard.org:81,:80");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(1, list.size());
        assertEquals("www.dashboard.org", list.get(0).getHost());
        assertEquals(81, list.get(0).getPort());

        SentinelConfig.setConfig(TransportConfig.CONSOLE_SERVER, "https://www.dashboard.org,http://www.dashboard.org:8080,www.dashboard.org,www.dashboard.org:8080");
        list = TransportConfig.getConsoleServerList();
        assertNotNull(list);
        assertEquals(4, list.size());
        assertEquals(Protocol.HTTPS, list.get(0).getProtocol());
        assertEquals(Protocol.HTTP, list.get(1).getProtocol());
        assertEquals(Protocol.HTTP, list.get(2).getProtocol());
        assertEquals(Protocol.HTTP, list.get(3).getProtocol());
        assertEquals(443, list.get(0).getPort());
        assertEquals(80, list.get(2).getPort());
    }