Update Persistent connection solution.
Added a timeout (at the moment hardcoded)