code: public static InetSocketAddress createInetSocketAddress(String hostname, int port,
  			boolean resolve) {
  		InetSocketAddress inetAddressForIpString = createForIpString(hostname, port);
  		if (inetAddressForIpString != null) {
  			return inetAddressForIpString;
  		}
  		else {
  			return resolve ? new InetSocketAddress(hostname, port)
  					: InetSocketAddress.createUnresolved(hostname, port);
  		}
  	}
docs: Creates InetSocketAddress instance. Numeric IP addresses will be detected and
  resolved without doing reverse DNS lookups.
  
  @param hostname ip-address or hostname
  @param port port number
  @param resolve when true, resolve given hostname at instance creation time
  @return InetSocketAddress for given parameters