Added client handler class and added trace statements

After merging this PR, please do update the samples.