enable support for alternative data compression

which can be supplied to the client. added code and tests. this runs tests with bz2, but the real reason i wanted this was to be able to plug in snappy compression (cause it's faster than zlib).