public String getAuthority() {
        StringBuilder ret = new StringBuilder();

        ret.append(getUserInformation());

        if (StringUtils.isNotEmpty(getHost())) {
            if (StringUtils.isNotEmpty(getUsername()) || StringUtils.isNotEmpty(getPassword())) {
                ret.append('@');
            }
            ret.append(getHost());
            if (getPort() != 0) {
                ret.append(':');
                ret.append(getPort());
            }
        }

        return ret.length() == 0 ? null : ret.toString();
    }
@Test
    void testGetAuthority() {
        URL url = URL.valueOf("admin1:hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=app1");
        assertEquals("admin1:hello1234@10.20.130.230:20880", url.getAuthority());

        URL urlWithoutUsername =
                URL.valueOf(":hello1234@10.20.130.230:20880/context/path?version=1.0.0&application=app1");
        assertEquals(":hello1234@10.20.130.230:20880", urlWithoutUsername.getAuthority());

        URL urlWithoutPassword = URL.valueOf("admin1:@10.20.130.230:20880/context/path?version=1.0.0&application=app1");
        assertEquals("admin1:@10.20.130.230:20880", urlWithoutPassword.getAuthority());

        URL urlWithoutUserInformation = URL.valueOf("10.20.130.230:20880/context/path?version=1.0.0&application=app1");
        assertEquals("10.20.130.230:20880", urlWithoutUserInformation.getAuthority());

        URL urlWithoutPort = URL.valueOf("admin1:hello1234@10.20.130.230/context/path?version=1.0.0&application=app1");
        assertEquals("admin1:hello1234@10.20.130.230", urlWithoutPort.getAuthority());
    }