NetworkUtil { public static InetAddress getLocalAddress() { if (LOCAL_ADDRESS != null) { return LOCAL_ADDRESS; } InetAddress localAddress = getLocalAddress0(); LOCAL_ADDRESS = localAddress; return localAddress; } private  NetworkUtil(); static InetAddress getLocalAddress(); static final String LOCALHOST; static final String ANYHOST; }
@Test public void testGetLocalAddress() { Assert.assertNotNull(NetworkUtil.getLocalAddress().getHostAddress()); }