Legacy test

I'm making this pull request so the ideas in the code can be discussed.  I don't think the code is anywhere near to final, but I'd like to know your views about the general ideas.  They are
* Monkey patch connection.py so that we don't need to use a socket server.
* Mechanism for interfacing with the API calls.
* General pattern for writing tests.

I like the idea that each test is, basically, some JSON data. Along with, of course, a test runner.  A different monkey-patch can extract backwards compatibility tests from existing usage.