@Test
    public void testParseSocketAddressToString() {
        String localhostName;
        String localIP;
        try {
            InetAddress inetAddress = InetAddress.getLocalHost();
            localhostName = inetAddress.getHostName();
            localIP = inetAddress.getHostAddress();
            if (null == localIP || StringUtils.isBlank(localIP)) {
                return;
            }
        } catch (UnknownHostException e) {
            localhostName = "localhost";
            localIP = "127.0.0.1";
        }
        SocketAddress socketAddress = new InetSocketAddress(localhostName, port);
        String res = RemotingUtil.parseSocketAddressToString(socketAddress);
        Assert.assertEquals(localIP + ":" + port, res);
    }
parse {@link InetSocketAddress} to get address (format [ip:port])
src/test/java/com/alipay/remoting/inner/utiltest/RemotingUtilTest.java