Move test code to test.py and implement receiver and monitor processes.