@Test public void shouldHandleJavaNetworkInterfaceThrowingExceptionsInIsLoopBack() throws Exception { when(networkInterface1.isLoopback()).thenThrow(new SocketException("Shrug")); Optional<NetworkInterface> en1 = provider.networkInterfaceById("en0"); assertTrue(en1.isPresent()); assertFalse(en1.get().isLoopback()); }
@Override public Optional<NetworkInterface> networkInterfaceById(String id) { return hal.getNetworkIFs().stream().filter(n -> n.getName().equalsIgnoreCase(id)).map( mapToNetworkInterface()).findAny(); }
DefaultNetworkMetrics implements NetworkMetrics { @Override public Optional<NetworkInterface> networkInterfaceById(String id) { return hal.getNetworkIFs().stream().filter(n -> n.getName().equalsIgnoreCase(id)).map( mapToNetworkInterface()).findAny(); } }
DefaultNetworkMetrics implements NetworkMetrics { @Override public Optional<NetworkInterface> networkInterfaceById(String id) { return hal.getNetworkIFs().stream().filter(n -> n.getName().equalsIgnoreCase(id)).map( mapToNetworkInterface()).findAny(); } protected  DefaultNetworkMetrics(HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); }
DefaultNetworkMetrics implements NetworkMetrics { @Override public Optional<NetworkInterface> networkInterfaceById(String id) { return hal.getNetworkIFs().stream().filter(n -> n.getName().equalsIgnoreCase(id)).map( mapToNetworkInterface()).findAny(); } protected  DefaultNetworkMetrics(HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); @Override List<NetworkInterface> networkInterfaces(); @Override Optional<NetworkInterface> networkInterfaceById(String id); @Override List<NetworkInterfaceLoad> networkInterfaceLoads(); @Override Optional<NetworkInterfaceLoad> networkInterfaceLoadById(String id); }
DefaultNetworkMetrics implements NetworkMetrics { @Override public Optional<NetworkInterface> networkInterfaceById(String id) { return hal.getNetworkIFs().stream().filter(n -> n.getName().equalsIgnoreCase(id)).map( mapToNetworkInterface()).findAny(); } protected  DefaultNetworkMetrics(HardwareAbstractionLayer hal, SpeedMeasurementManager speedMeasurementManager); @Override List<NetworkInterface> networkInterfaces(); @Override Optional<NetworkInterface> networkInterfaceById(String id); @Override List<NetworkInterfaceLoad> networkInterfaceLoads(); @Override Optional<NetworkInterfaceLoad> networkInterfaceLoadById(String id);  }