connect method and tests