network refactors

This adds changes discussed in https://github.com/bitpay/bitcore/issues/216 and https://github.com/bitpay/bitcore/issues/215 and a simple test.