Isssue #17 - fix to use correct protocol based on port