veyron/tools/findunusedport: move find port logic to common lib

This CL moves findunusedport logic to a common location inside
veyron/lib/testutil. It also changes the port-finding logic to use
bind(port=0) and a subsequent call to getsockname to find an unused
port.

Tested by hand.

Change-Id: I7ea13e23e47038d9b43db60c6a1a74371ae8ce0a
2 files changed
tree: efc010cc2f8208657071dcedc59304cb15a843eb
  1. lib/
  2. profiles/
  3. runtimes/
  4. security/
  5. services/
  6. tools/