TestBuildNetContainer failed with an empty /otherhost instead of the
expected "foobar" hostname on CI hosts with newer AppArmor policy.
The listener ran "nc -ll -p 1234 -e hostname".
With the stacked docker-default//&unconfined confinement seen in CI,
exec'ing /bin/hostname attached the host's "hostname" AppArmor profile,
which denied writing to the inherited socket:
```
apparmor="DENIED" operation="file_inherit" class="net" info="failed type match" error=-13 profile="hostname" comm="hostname" ... requested="send receive" denied="send receive"
```
The client then saw EOF and exited successfully with no output.
Move the test to integration/build as TestBuildNetworkModeContainer and
reply with shell builtins ("echo $HOSTNAME") so no binary named
hostname is exec'd.
Also wait until the listener answers with the expected hostname before
starting the build, instead of relying on a single connection attempt.
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>