added connection validation methods + tests
implemented to_json method