HADOOP-11241. Fixed intermittent TestNMSimulator failure due to timing issue. Contributed by Varun Vasudev.

(cherry picked from commit 260ab6d5f462d0fe1a4312cbba1c098141e3870e)