make the service example work

issue #98 requires connecting to localhost (which `hostname` may resolve to) will not work.
sync with README
Merge pull request #346 from srid/patch-2

make the service example work