Factory for connections allows generating different connections.
Added a connection factory for tcp connections.