Test cases and bug fixes, Also constructor for PsSocket that takes JSONObject.

Signed-off-by: bregell <johan_bregell@hotmail.com>