Here you can find the source of toString(InetSocketAddress socketAddress)
public static String toString(InetSocketAddress socketAddress)
//package com.java2s; //License from project: Open Source License import java.net.InetSocketAddress; public class Main { private static final String TO_STRING_FORMAT = "%s:%s"; /**/*from w w w . ja v a 2 s.co m*/ * Returns <host>:<port> */ public static String toString(InetSocketAddress socketAddress) { return String.format(TO_STRING_FORMAT, socketAddress.getAddress().getHostAddress(), socketAddress.getPort()); } }