// set the buffer of the outgoing message
outgoingMessage.setBuffer(buf);
// encode the message
BER.encodeHeader(outgoingMessage, BER.SEQUENCE, length);
version.encodeBER(outgoingMessage);
community.encodeBER(outgoingMessage);
pdu.encodeBER(outgoingMessage);
return SnmpConstants.SNMP_MP_OK;