added getConnections method. Fixes #2339.