finsihed proto tests.

Also includes more fixes found by the tests.
added more unit tests.
return atoms instead of strings from exit.
fixed a security issue with the control channel.

Also added stubbed unit tests.