Unit tests and refactor

Working on adding unit tests and getting a good test coverage.

On the way, I'm trying to unify some duplicate code especially related to launching btcd/btcwallet and connecting rpc client.
I don't think %s is the correct conversion here, since you're comparing maps.  Either use %v, or spew.Sdump to create a string.