How to debug TLS Handshake error?

Okay I finally figured it out. Turns out I was opening multiple connections to the same device. I never thought to check that because I was only going by the error message.

Also, I just noticed that the java implementation never sent any close messages, so the other side would keep the connection open for some time (making subsequent connections fail too).

Thanks for your help figuring this out!