NetworkUtil { public static String dumpLocalNetworkInfo() throws UnknownHostException, SocketException { StringBuffer buffer = new StringBuffer(); InetAddress addr = InetAddress.getLocalHost(); buffer.append("Localhost: " + getAddrInfo(addr) + "\n"); Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces(); buffer.append("Network interfaces:\n"); while (nifs.hasMoreElements()) { NetworkInterface nif = nifs.nextElement(); buffer.append(" - " + getNetworkInterfaceInfo(nif) + "\n"); Enumeration<InetAddress> addresses = nif.getInetAddresses(); while (addresses.hasMoreElements()) { addr = addresses.nextElement(); buffer.append(" " + getAddrInfo(addr) + "\n"); } } return buffer.toString(); } private  NetworkUtil(); static void main(String[] args); static InetAddress getLocalAddress(); static InetAddress getLocalAddressWithMulticast(); static InetAddress findLocalAddressViaNetworkInterface(); static boolean isMulticastSupported(); static boolean isMulticastSupported(NetworkInterface pNif); static boolean isMulticastSupported(InetAddress pAddr); static List<InetAddress> getMulticastAddresses(); static String getAgentId(int objectId, String type); static String sanitizeLocalUrl(String pRequestURL); static String dumpLocalNetworkInfo(); static String replaceExpression(String pValue);  }
@Test public void dump() throws SocketException, UnknownHostException { try { System.out.println(NetworkUtil.dumpLocalNetworkInfo()); } catch (Exception exp) { exp.printStackTrace(); } }