@Test
public void testInvalidFd() {

    final MockPingListener listener = new MockPingListener();
    new MockPing(null, listener) {
        @Override
        protected FileDescriptor socket(final int inet, final int proto) {
            try (final FileInputStream in = new FileInputStream(File.createTempFile("testfd", ".bin"))){
                return in.getFD();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }.run();
    Assert.assertTrue(listener.exception instanceof IOException);
}