Implement basic connecting and connection sharing

Fixes #13