public boolean parse(final String s) {
        if (StringUtils.isEmpty(s) || StringUtils.isBlank(s)) {
            return false;
        }

        final String[] tmps = Utils.parsePeerId(s);
        if (tmps.length < 2 || tmps.length > 4) {
            return false;
        }
        try {
            final int port = Integer.parseInt(tmps[1]);
            this.endpoint = new Endpoint(tmps[0], port);

            switch (tmps.length) {
                case 3:
                    this.idx = Integer.parseInt(tmps[2]);
                    break;
                case 4:
                    if (tmps[2].equals("")) {
                        this.idx = 0;
                    } else {
                        this.idx = Integer.parseInt(tmps[2]);
                    }
                    this.priority = Integer.parseInt(tmps[3]);
                    break;
                default:
                    break;
            }
            this.str = null;
            return true;
        } catch (final Exception e) {
            LOG.error("Parse peer from string failed: {}.", s, e);
            return false;
        }
    }
@Test
    public void testToStringParseFailed() {
        final PeerId pp = new PeerId();
        final String str1 = "";
        final String str2 = "192.168.1.1";
        final String str3 = "92.168.1.1:8081::1:2";
        assertFalse(pp.parse(str1));
        assertFalse(pp.parse(str2));
    }