Here you can find the source of getLocalHost()
public static InetAddress getLocalHost()
//package com.java2s; //License from project: Apache License import java.net.InetAddress; import java.net.UnknownHostException; public class Main { public static InetAddress getLocalHost() { try {// w w w . jav a 2s. com return InetAddress.getLocalHost(); } catch (UnknownHostException e) { throw new AssertionError(e); } } }