Port PairManager and add a test

Signed-off-by: Aleksi Sapon <QcTechs@gmail.com>