Make the TestAllocate{UDP,TCP}PortLocalhost more reliable

- For the TCP test try again if socat wasn't listening yet;
- For the UDP test raise the timeout to a minute to workaround what
  seems to be an issue with Linux.