Here you can find the source of getHost(String host)
private static String getHost(String host)
//package com.java2s; import java.net.InetAddress; import java.net.UnknownHostException; public class Main { /**/*from ww w . ja v a 2 s. c om*/ * Returns the host address, if the supplied host is localhost, else returns * it, unchanged. */ private static String getHost(String host) { if (host.equals("localhost")) { try { host = InetAddress.getLocalHost().getHostAddress(); } catch (UnknownHostException ignore) { } } return host; } }