tests: extract wire protocol shell helpers to standalone file
This will make it easier for other tests to get up and running without
the boilerplate.
Differential Revision: https://phab.mercurial-scm.org/D3176
To run the tests, do:
cd tests/
python run-tests.py
See https://mercurial-scm.org/wiki/WritingTests for
more information on writing tests.