Protocol inference