Port of replication test for AAE full sync to master.

@lordnull @Vagabond