Closes getlantern/lantern#1872

Most of the changes are in lantern-common, but this does have the unit test.