In the UK a magistrate is addressed as your Worship.
The salutation for a retired General is "General". A retired general can also be addressed in a letter thus: General W. Smith (ret):
His/Her Excellency
'Dear Mayor Smith' is acceptable for ordinary communication. 'Your Honor' is a more formal salutation. In Canada (and, I think, in Britain also) it might be better to use 'Your Worship.' (A mayor historically had the powers of a magistrate.) Check with the municipality's office of protocol when in doubt.
There is no general or standard salutation for an individual with a masters degree, like you would have with a doctorate degree. In other words, Dr. John Smith.
The proper salutation for a probate judge is "The Honorable [Judge's Full Name]."
What is the proper salutation for a register of wills, e.g. Honorable John White?
The proper salutation when writing to a judge is "Dear Judge [Last Name]" or "Your Honor."
If currently on active duty, the proper way is (rank)(last name). Example; Sergeant Jones, Major General Smith.
the correct salutation for two men is Messrs
Your Honor
Hello.
Chers Monsieur et Madame Consulat Général,