Commonalize replication function
Merge pull request #49 from Metaswitch/no-more-curl-multi

Reviewer Alex - Commonalize replication function