Implement a set_cookie method in TestApp

I spent all morning trying to figure out how to set a cookie.  Thought I should share it.

The encoder dictionary was copied from [Python's cookie module](http://hg.python.org/cpython/file/2.7/Lib/Cookie.py).  I'm not sure what the legal ramifications are of that.  (I chose not to import it because it's a "private" member of the module, so it might change at any time.)