I will admit, your question is ambiguous. A sociopath is probably going to be very skilled at hiding their nature and apear charming. I'm going to go with a scenario of some kind of child custody battle....? You may, at your own cost, petition the court to order the other party to submit to a psychological examination. You would submit why it would be relevant to the case and see where it goes. Sociopaths are narcissistic by nature and often lie. Ask the person questions about some kind of an event that took place. Make sure you ask about details of their answers. You or someone should write down their responses. Continue asking questions on differents occassions or topics. Then eventually turn around and ask them the same questions you did earlier, but rephrase it a bit and see how their answers change. Good luck!
I am not an attorney and in no way should this be construed as legal advice.