added unit tests for client and producer

https://www.pivotaltracker.com/s/projects/684825/stories/82225792

This brings unit tests to ~ 90% coverage and addresses a number of issues identified by sonar.