Rewrite connection class to be better

* consistently get back json
* ssl verification stuff