Split matching logic from SharedNegotiator::negotiateAll into several functions.