Does anyone know if JNDI by default is supposed to do hostname validation with LDAPS?

The SSL certificate is validated, but the hostname is not.

What is the best way to implement or enable this validation?