fix #17 add unit test for phone communication

start refactoring TerminalApp into multiple classes