...
Each structure is implemented as a Java Class.
...
Encoding the PDU
Now, we have to transform these Java classes to a PDU
...
Code Block |
---|
0x30 0x33 0x02 0x01 0x01 0x60 0x2E 0x02 0x01 0x03 0x04 0x1F 0x75 0x69 0x64 0x3D 0x61 0x6B 0x61 0x72 0x61 0x73 0x75 0x6C 0x75 0x2C 0x64 0x63 0x3D 0x65 0x78 0x61 0x6D 0x70 0x6C 0x65 0x2C 0x64 0x63 0x3D 0x63 0x6F 0x6D 0x80 0x08 0x70 0x61 0x73 0x73 0x77 0x6F 0x72 0x64 |
...
That's it ! We now have a ByteBuffer which is a PDU. MINA, it's up to you ...
Decoding the PDU
Decoding a BindRequest message is a little bit more complicated. We will have to implement a state machine representing all the possible states and transitions, with actions.
TO BE CONTINUED
Conclusion
The encoding process is simple. One who wants to implement an encoder has to be warned about some tricks :
...