@Test
public void testFindingTheOSNetworkInterface() {

    final Enumeration<NetworkInterface> networkInterfaces = networkUtils.getNetworkInterfaces();
    final OperatingSystemNetworkInfo osNicInfo = new OperatingSystemNetworkInfo(settings, errorHandler);
    final NetworkInterface osInterface = osNicInfo.getOperatingSystemNetworkInterface();
    if (networkInterfaces == null) {
        System.err.println("No network interfaces found.");
        assertNull(osInterface);
        return;
    }
    boolean validNetworkAvailable = false;
    while (networkInterfaces.hasMoreElements()) {
        final NetworkInterface networkInterface = networkInterfaces.nextElement();
        if (networkUtils.isUsable(networkInterface)) {
            validNetworkAvailable = true;
            break;
        }
    }
    if (!validNetworkAvailable) {
        System.err.println("No usable network interfaces found.");
        assertNull(osInterface);
        return;
    }
    assertNotNull(osInterface);
    // This is known to sometimes fail in Vista. It is unknown why Vista
    // prefers unusable network interfaces.
    assertTrue(networkUtils.isUsable(osInterface));
}