public static String toUrl(ProviderInfo providerInfo) {
        String uri = providerInfo.getProtocolType() + "://" + providerInfo.getHost() + ":" + providerInfo.getPort();
        uri += StringUtils.trimToEmpty(providerInfo.getPath());
        StringBuilder sb = new StringBuilder();
        if (providerInfo.getRpcVersion() > 0) {
            sb.append("&").append(ProviderInfoAttrs.ATTR_RPC_VERSION).append("=").append(providerInfo.getRpcVersion());
        }
        if (providerInfo.getSerializationType() != null) {
            sb.append("&").append(ProviderInfoAttrs.ATTR_SERIALIZATION).append("=")
                .append(providerInfo.getSerializationType());
        }
        for (Map.Entry<String, String> entry : providerInfo.getStaticAttrs().entrySet()) {
            sb.append("&").append(entry.getKey()).append("=").append(entry.getValue());
        }
        if (sb.length() > 0) {
            uri += sb.replace(0, 1, "?").toString();
        }
        return uri;
    }
@Test
    public void toUrl() throws Exception {
        {
            String src = "10.15.233.114:12200";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.EMPTY);
            Assert.assertEquals(ProviderHelper.toUrl(providerInfo), providerInfo.getProtocolType() + "://" + src);
        }
        {
            String src = "10.15.233.114:12200/";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.CONTEXT_SEP);
            Assert.assertEquals(ProviderHelper.toUrl(providerInfo), providerInfo.getProtocolType() + "://" + src);
        }
        {
            String src = "bolt://10.15.233.114:12200";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getProtocolType(), "bolt");
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.EMPTY);
            Assert.assertEquals(ProviderHelper.toUrl(providerInfo), src);
        }
        {
            String src = "bolt://10.15.233.114:12200/";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getProtocolType(), "bolt");
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.CONTEXT_SEP);
            Assert.assertEquals(ProviderHelper.toUrl(providerInfo), src);
        }
        {
            String src = "bolt://10.15.233.114:12200?weight=222&serialization=hessian2";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getProtocolType(), "bolt");
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.EMPTY);
            Assert.assertEquals(providerInfo.getWeight(), 222);
            Assert.assertEquals(providerInfo.getSerializationType(), "hessian2");
            Assert.assertEquals(ProviderHelper.toProviderInfo(ProviderHelper.toUrl(providerInfo)), providerInfo);
        }
        {
            String src = "bolt://10.15.233.114:12200/?weight=222&serialization=hessian2";
            ProviderInfo providerInfo = ProviderHelper.toProviderInfo(src);
            Assert.assertEquals(providerInfo.getProtocolType(), "bolt");
            Assert.assertEquals(providerInfo.getHost(), "10.15.233.114");
            Assert.assertEquals(providerInfo.getPort(), 12200);
            Assert.assertEquals(providerInfo.getPath(), StringUtils.CONTEXT_SEP);
            Assert.assertEquals(providerInfo.getWeight(), 222);
            Assert.assertEquals(providerInfo.getSerializationType(), "hessian2");
            Assert.assertEquals(ProviderHelper.toProviderInfo(ProviderHelper.toUrl(providerInfo)), providerInfo);
        }
    }