This class is NOT thread safe and should never be used with more than one thread at a time
This is a state machine, handled by the process method
States are:
- NOT_CONNECTED -> connect() -> CONNECTED
- CONNECTED -> setMessage() -> READY TO WRITE
- READY_TO_WRITE -> write() -> READY TO WRITE | READY TO READ
- READY_TO_READ -> read() -> READY_TO_READ | TRANSFER_COMPLETE
- TRANSFER_COMPLETE -> CONNECTED
author: Filip Hanik version: 1.0