I have created some HTTPS-Server with a self signed certificate with this CN=localhost
. But when I'm starting the Client, it tells me some Bind-Exception:
socket::connect fails with error code = 10049
I created some new certificate with CN=hostname
, which I found out (and which is the computer name) with following line:
hostname = InetAddress.getLocalHost());
But this way is not a practical for me. I want to create one certificate with some URL like example.com
and want to use this certificate more than one time. So i had following idea: I adding some url to /etc/hosts-file with this:
127.0.0.1 example.com
And then I'm using the URL example.com
.
Is there any way to change InetAddress.getLocalhost? Or is there a possibility to use some customer ip-address order hostname?
I have used:
InetSocketAddress address = new InetSocketAddress("test.com",9999);
to create a customer address, but this not resolved the Bind-Exception.
Do someone have any ideas?