tests/tls/connection: let the kernel allocate ports

The connection test was trying to allocate ports itself, but wasn't
actually testing that it worked, so sometimes it didn't. Reorganize to
let the kernel bind to a random port instead.

https://bugzilla.gnome.org/show_bug.cgi?id=719728
tls/tests/connection: don't spin waiting for shutdown to complete

Rather than spinning forever waiting for variables to be unreffed by
other threads, sleep for increasingly-long intervals until about 10
seconds pass, and then abort if the variable is still set.

Addresses the current symptoms of
https://bugzilla.gnome.org/show_bug.cgi?id=719727, but not the
underlying leak that appears to be happening in some cases.
GTlsConnection: avoid non-literal format strings

The error handling in GTlsConnection involved translated format strings
that were then passed to another function where the arguments were
applied.  This prevents the C compiler from enforcing restrictions on
the format string and runs afoul of -Werror=format-nonliteral, breaking
the build under clang.

Fix it up so that the error handling function takes the format string
along with the argument and calls g_error_new_valist().  This allows the
compiler to check that we're getting it right.

https://bugzilla.gnome.org/show_bug.cgi?id=720081