@Test void testCloseAllConnections() throws Exception { final String deviceIdentification1 = "DA_DVC_1"; final ClientConnection clientConnection1 = ClientConnectionFactory.forDevice(deviceIdentification1); this.connectionCache.addConnection(deviceIdentification1, clientConnection1); final String deviceIdentification2 = "DA_DVC_2"; final ClientConnection clientConnection2 = ClientConnectionFactory.forDevice(deviceIdentification2); this.connectionCache.addConnection(deviceIdentification2, clientConnection2); this.clientConnectionService.closeAllConnections(); verify(this.iec60870Client).disconnect(clientConnection1); verify(this.iec60870Client).disconnect(clientConnection2); verify(this.connectionCache).removeConnection(deviceIdentification1); verify(this.connectionCache).removeConnection(deviceIdentification2); }
@PreDestroy public void closeAllConnections() { LOGGER.info("Closing all connections."); final Collection<ClientConnection> connections = this.connectionCache.getConnections(); LOGGER.warn("{} active connections found, closing all.", connections.size()); connections.forEach(this::close); }
ClientConnectionService { @PreDestroy public void closeAllConnections() { LOGGER.info("Closing all connections."); final Collection<ClientConnection> connections = this.connectionCache.getConnections(); LOGGER.warn("{} active connections found, closing all.", connections.size()); connections.forEach(this::close); } }
ClientConnectionService { @PreDestroy public void closeAllConnections() { LOGGER.info("Closing all connections."); final Collection<ClientConnection> connections = this.connectionCache.getConnections(); LOGGER.warn("{} active connections found, closing all.", connections.size()); connections.forEach(this::close); }  }
ClientConnectionService { @PreDestroy public void closeAllConnections() { LOGGER.info("Closing all connections."); final Collection<ClientConnection> connections = this.connectionCache.getConnections(); LOGGER.warn("{} active connections found, closing all.", connections.size()); connections.forEach(this::close); }  ClientConnection getConnection(final RequestMetadata requestMetadata); void closeConnection(final String deviceIdentification); synchronized void close(final ClientConnection connection); @PreDestroy void closeAllConnections(); }
ClientConnectionService { @PreDestroy public void closeAllConnections() { LOGGER.info("Closing all connections."); final Collection<ClientConnection> connections = this.connectionCache.getConnections(); LOGGER.warn("{} active connections found, closing all.", connections.size()); connections.forEach(this::close); }  ClientConnection getConnection(final RequestMetadata requestMetadata); void closeConnection(final String deviceIdentification); synchronized void close(final ClientConnection connection); @PreDestroy void closeAllConnections();  }