code: public static String formatAddress(InetSocketAddress inet){
          if(inet == null){
              throw new NullPointerException();
          }
          StringBuilder result = new StringBuilder();
          if(inet.isUnresolved()){
              result.append(inet.getHostName());
          }else{
              result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress())));
          }
          result.append(":").append(inet.getPort());
          return result.toString();
      }
docs: Converts socket address into string literal, which has form: 'address:port'. Example:<br>
  <ul>
  <li>127.0.0.1:8080</li>
  <li>dns.name.com:8080</li>
  <li>[0fe:1::20]:8080</li>
  <li>[::1]:8080</li>
  </ul>
  @param inet
  @return