agent: fix reg of dynamically allocated ports

Also make job service registration test that this works.
Merge pull request #66 from spotify/dano/fix-registration-of-dynamically-allocated-ports

agent: fix reg of dynamically allocated ports