EnOceanConnectionManager { public synchronized void disconnect() throws ConnectionException { if(connection != null) { connection.disconnect(); } } EnOceanConnectionManager(); synchronized EnOceanConnection getConnection(EspPortConfiguration configuration, RadioTelegramListener listener); synchronized void disconnect();  }
@Test public void testDisconnect() throws Exception { TestConnectionManager mgr = new TestConnectionManager(); EspPortConfiguration config = new EspPortConfiguration(); config.setComPort("COM1"); config.setCommLayer(EspPortConfiguration.CommLayer.PAD); config.setSerialProtocol(EspPortConfiguration.SerialProtocol.ESP3); RadioTelegramListener listener = new TestListener(); EnOceanConnection conn1 = mgr.getConnection(config, listener); mgr.disconnect(); Assert.assertEquals(1, ((TestEsp3Connection) conn1).disconnectCount); }