Fix TaskTest.nmap6 test

Fix #756.

Don't assume that thread scheduling is deterministic or that
Thread.sleep can be a form of synchronization.
(One could maybe also remove the Thread.sleep calls, to speed up the
test). Depending on the actual intent of the test, this might or might
not be appropriate.