Fix race condition by synchronizing access/modification of connection @state

(Per @iconara's request on https://github.com/iconara/ione/pull/8)

Ensure @state check and set operations are done in critical section, to avoid this method from being executed multiple times in a multi-threaded race-condition scenario.

I noticed that the ```@lock``` attribute was being referenced in ```BaseConnection``` but defined in its subclasses.  I pulled its creation/initialization into the initializer of ```BaseConnection```.