[core] check if port is available (Fixes LP1223615)