Support clean session flag from protocol
Make socket None on connection close and read/write only if socket is available
Another portion of unit tests - adding flow checks