// Create the SNMP session to the manager
SnmpPeer peer = new SnmpPeer(this.address, this.port, this.localAddress, this.localPort);
peer.setRetries(this.retries);
peer.setTimeout(this.timeout);
SnmpParameters parameters = peer.getParameters();
switch(this.version) {
case SnmpAgentService.SNMPV1:
parameters.setVersion(SnmpSMI.SNMPV1);
break;
case SnmpAgentService.SNMPV2:
parameters.setVersion(SnmpSMI.SNMPV2);
break;
default:
parameters.setVersion(SnmpSMI.SNMPV1);
}
parameters.setReadCommunity(this.readCommunity);
peer.setParameters(parameters);
this.session = new SnmpSession(peer);
this.session.setDefaultHandler(this);
}