[Thread] Replace the "ot-ctl factoryreset" with the java leave() API

The leave() API can now correctly clear the in-memory state for the
Thread stack, it's better to use the leaveAndWait() API in the tests to
ensure timing sequences

Bug: 338061061
Change-Id: Ic91f8043cd5a35f19b9161c5778f83b83a713946
4 files changed