More tests for client/doc.

This includes a fix for cleaning up contexts on a doc. Tests for the
win.
Continue implementing presence support for bulkSubscribe