refactor protocol setup in tests