Do not exit the main thread. Wait for the message listener to notify the main thread before terminating the main thread.