Added a setPort method and choose between http or https