Family Law Questions? Ask a Family Lawyer Online.
Assuming this happened in NY, the Judge violated Rule 100.3(B)(6) of the NY Rules Governing Judicial Conduct
"(6) A judge shall accord to every person who has a legal interest in a proceeding, or that person's lawyer, the right to be heard according to law. A judge shall not initiate, permit, or consider ex parte communications, or consider other communications made to the judge outside the presence of the parties or their lawyers concerning a pending or impending proceeding, except:
(a) Ex parte communications that are made for scheduling or administrative purposes and that do not affect a substantial right of any party are authorized, provided the judge reasonably believes that no party will gain a procedural or tactical advantage as a result of the ex parte communication, and the judge, insofar as practical and appropriate, makes provision for prompt notification of other parties or their lawyers of the substance of the ex parte communication and allows an opportunity to respond.(b) A judge may obtain the advice of a disinterested expert on the law applicable to a proceeding before the judge if the judge gives notice to the parties of the person consulted and a copy of such advice if the advice is given in writing and the substance of the advice if it is given orally, and affords the parties reasonable opportunity to respond."
explains how to file a complaint, and has a link to the complaint form.
I hope this information is helpful.