If not passing a `hostname`, use `None` in `getaddrinfo`.

On my machine, passing an empty string to `getaddrinfo` raises errno 2, "No such file or directory". Use `None` if `hostname` is a string.