Fixed the connection creation using the factory

Updated the parameters in the createConnection method to allow the usage of the factory.