test that commands sent before reconnection don't raise errors

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
comments on the instance variables

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
make sure only the right 'close' handlers are set

Signed-off-by: Tomas Neme <lacrymology@gmail.com>
use a queue to avoid sending commands before the connection is ready

Signed-off-by: Tomas Neme <lacrymology@gmail.com>