I am using using a java library that is making a HTTP connection to an endpoint that I provide it. The library is using apache DefaultHTTPClient and I cannot change this or modify the code in any way (I know how to solve this if I create the instance of the HTTP client but I don't have access to this). It is throwing SSL exceptions when connecting to the endpoint. I have to use HTTPS and I have to use the IPs (connecting to multiple IPs with the same cert). The error I am getting is:
javax.net.ssl.SSLException: Certificate for <IP> doesn't match common name of the certificate subject: domainname
Where IP and domainname are replaced with the specific IP and domain name of the cert.
I thought if I add the ips and hostname to my /etc/hosts file this would work but I am still getting the exception. Is there anyway top map the IPs to the hostname so the cert will be accepted? Is there anything that can be done at the JVM or even at the linux level?
Thanks