- improved determination of server host and port
- script can be sourced to test function individually