Section 25. Whoever, being required by a justice of the peace, upon view of a breach of the peace or of any other offence proper for his cognizance, to apprehend the offender, refuses or neglects to obey such justice, shall be punished as provided in the preceding section; and no person to whom such justice is known or declares himself to be a justice of the peace shall plead any excuse on pretence of ignorance of his office.