The library generate mocha tester errors

I'm using mocha to test my code which uses your library. 
Unfortunately you don't use var prefix in some places where you declare local variables what causes errors like this one:
Error: global leaks detected: subSessionId, encoding
 

My pull corrects that issue.