Bug 799732 - token server client

This builds on 799734 so that we can test it against live servers.  (There are some static tests for good measure, too.)