Added unit.go test command similar to pyupr by Mike.

This lead to couple of bug fixes and minor design alteration in the way
streams are opened and handled.