tests: fix pkd build breakages

Fix a build breakage when '-DWITH_SERVER=OFF' is set: skip building the
pkd test for that case.  Add some missing includes for the OpenIndiana
and FreeBSD builds.

Signed-off-by: Jon Simons <jon@jonsimons.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
connect: Do not fail if the connect is in progress.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>