@Test public void whenLeaseBecomesInvalidConnectionIsClosedCopingWithConnectionAlreadyClosed() throws Exception { when(leaseMaintainer.getCurrentLease()).thenReturn(new LeaseImpl(timeSource, -200L, -100L)); doThrow(IllegalStateException.class).when(connection).close(); thread.start(); thread.join(); verify(connection).close(); }
@Override public void close() throws IOException { shutdown = true; }
LeaseExpiryConnectionKillingThread extends Thread implements Closeable { @Override public void close() throws IOException { shutdown = true; } }
LeaseExpiryConnectionKillingThread extends Thread implements Closeable { @Override public void close() throws IOException { shutdown = true; } LeaseExpiryConnectionKillingThread(LeaseMaintainer leaseMaintainer, Connection connection); }
LeaseExpiryConnectionKillingThread extends Thread implements Closeable { @Override public void close() throws IOException { shutdown = true; } LeaseExpiryConnectionKillingThread(LeaseMaintainer leaseMaintainer, Connection connection); void run(); @Override void close(); }
LeaseExpiryConnectionKillingThread extends Thread implements Closeable { @Override public void close() throws IOException { shutdown = true; } LeaseExpiryConnectionKillingThread(LeaseMaintainer leaseMaintainer, Connection connection); void run(); @Override void close();  }