ClientConnectionEventListener implements ConnectionEventListener { @Override public void connectionClosed(final IOException e) { LOGGER.info("Connection with device {} closed.", this.deviceIdentification); LOGGER.debug("Exception: ", e); this.connectionCache.removeConnection(this.deviceIdentification); } ClientConnectionEventListener(final String deviceIdentification, final ClientConnectionCache connectionCache,
            final ClientAsduHandlerRegistry asduHandlerRegistry, final ResponseMetadata responseMetadata); @Override void newASdu(final ASdu asdu); @Override void connectionClosed(final IOException e);  }
@Test public void shouldRemoveConnectionFromCacheWhenConnectionIsClosed() { final IOException e = new IOException(); this.clientConnectionEventListener.connectionClosed(e); verify(this.connectionCache).removeConnection(DEVICE_IDENTIFICATION); }