}
@Override
public void connect(SnmpClientHandler clientHandler) {
Hold c = clients.get(address);
if (c == null) {
SnmpClient snmpClient = new SnmpClient();
if (community != null) {
snmpClient.withCommunity(community);
}
if ((authLogin != null) && (authPassword != null) && (authDigestAlgorithm != null) && (privLogin != null) && (privPassword != null) && (privEncryptionAlgorithm != null)) {
snmpClient.withLoginPassword(authLogin, authPassword, authDigestAlgorithm, privLogin, privPassword, privEncryptionAlgorithm);
}
if (bulkSize >= 0) {
snmpClient.withBulkSize(bulkSize);
}
if (getLimit >= 0) {
snmpClient.withBulkSize(getLimit);
}
if (!Double.isNaN(minTimeToRepeat)) {
snmpClient.withMinTimeToRepeat(minTimeToRepeat);
}
if (!Double.isNaN(repeatTime)) {
snmpClient.withRepeatTime(repeatTime);
}
if (!Double.isNaN(timeoutFromBeginning)) {
snmpClient.withTimeoutFromBeginning(timeoutFromBeginning);
}
if (!Double.isNaN(timeoutFromLastReception)) {
snmpClient.withTimeoutFromLastReception(timeoutFromLastReception);
}
if (readyFactory != null) {
snmpClient.override(readyFactory);
}
c = new Hold(snmpClient.withAddress(address).withQueue(queue, repeatExecutor));
final Hold cc = c;
clients.put(address, cc);
c.handlers.add(clientHandler);