Fix connect Null Pointer Exception, threads not synchronized with class ...

...result as transport = null in some cases.