Make the tests pass in a FreeBSD jail

When FreeBSD runs as a jail, with the security.jail.jailed sysctl set,
the loopback address behaves differently.  jail(2) says:

  All IP activity will be forced to happen to/from the IP number
  specified, which should be an alias on one of the network interfaces.
  All connections to/from the loopback address (127.0.0.1 for IPv4, ::1
  for IPv6) will be changed to be to/from the primary address of the jail
  for the given address family.