fix default port for https, rename agent to agentFactory, fix tests