ClientConnectionService { public void closeConnection(final String deviceIdentification) { final ClientConnection connection = this.connectionCache.getConnection(deviceIdentification); this.close(connection); }  ClientConnection getConnection(final RequestMetadata requestMetadata); void closeConnection(final String deviceIdentification); synchronized void close(final ClientConnection connection); @PreDestroy void closeAllConnections();  }
@Test void testDisconnectByDeviceIdentification() throws Exception { final String deviceIdentification = "DA_DVC_1"; final ClientConnection clientConnection = ClientConnectionFactory.forDevice(deviceIdentification); this.connectionCache.addConnection(deviceIdentification, clientConnection); this.clientConnectionService.closeConnection(deviceIdentification); verify(this.iec60870Client).disconnect(clientConnection); verify(this.connectionCache).removeConnection(deviceIdentification); }