Halt xbee wait frame thread before terminating process.
Add unite test code.