Following exception happens when OkHttp tries to connect to a server using IP address:
javax.net.ssl.SSLPeerUnverifiedException: Hostname 195.168.2.68 not verified:
certificate: sha256/rxO7r+KJOj2iTLR+MPWF7rNV45BYYQKvhlsb4K6yHXE=
DN: CN=test sandbox,OU=it,O=abc,L=newyork,ST=western,C=us
subjectAltNames: []
A server has a self-signed SSL Certificate which was generated for server's IP address.
Base Url is : https://195.168.2.68:8092/Mobile/
Whats going wrong here?
and
Since
195.168.2.68
does not matchtest
it all works as expected as CommonName is what is mainly being used for matching, so you need either properly issued certificate or you may i.e. delegatetest
domain to point to195.168.2.68
and usetest
instead of IP to make it match CN. But I'd fix the certificate in first place.