### Question:
OvsdbDataTreeChangeListener implements ClusteredDataTreeChangeListener<Node>, AutoCloseable { private void connect(@NonNull Collection<DataTreeModification<Node>> changes) { for (DataTreeModification<Node> change : changes) { if (change.getRootNode().getModificationType() == DataObjectModification.ModificationType.WRITE || change .getRootNode().getModificationType() == DataObjectModification.ModificationType.SUBTREE_MODIFIED) { DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification = change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class); if (ovsdbNodeModification != null && ovsdbNodeModification.getDataBefore() == null) { OvsdbNodeAugmentation ovsdbNode = ovsdbNodeModification.getDataAfter(); if (ovsdbNode != null) { ConnectionInfo key = ovsdbNode.getConnectionInfo(); if (key != null) { InstanceIdentifier<Node> iid = cm.getInstanceIdentifier(key); if (iid != null) { LOG.warn("Connection to device {} already exists. Plugin does not allow multiple " + "connections to same device, hence dropping the request {}", key, ovsdbNode); } else { try { cm.connect(change.getRootPath().getRootIdentifier(), ovsdbNode); LOG.info("OVSDB node has been connected: {}",ovsdbNode); } catch (UnknownHostException | ConnectException e) { LOG.warn("Failed to connect to ovsdbNode", e); } } } } } } } } OvsdbDataTreeChangeListener(DataBroker db, OvsdbConnectionManager cm,
            InstanceIdentifierCodec instanceIdentifierCodec); @Override void close(); @Override void onDataTreeChanged(@NonNull Collection<DataTreeModification<Node>> changes);  }### Answer:
@Test public void testConnect() throws UnknownHostException, InterruptedException, ExecutionException { InetAddress inetAddress = InetAddress.getByName("127.0.0.1"); int port = 6640; IpAddress ipAddress = SouthboundMapper.createIpAddress(inetAddress); PortNumber portNumber = new PortNumber(Uint16.valueOf(port)); final ConnectionInfo connectionInfo = new ConnectionInfoBuilder() .setRemoteIp(ipAddress) .setRemotePort(portNumber) .build(); final InstanceIdentifier<Node> iid = SouthboundUtils.createInstanceIdentifier(connectionInfo); WriteTransaction transaction = dataBroker.newReadWriteTransaction(); transaction.mergeParentStructurePut(LogicalDatastoreType.CONFIGURATION, iid, SouthboundUtils.createNode(connectionInfo)); transaction.commit().get(); Mockito.verify(ovsdbConnection, Mockito.timeout(5000)).connect(inetAddress, port); }