I am trying to have a server (written in java) redirect to a HTTPS url (the url will never change) when accessed. If I compile the code with
java -Djavax.net.ssl.keyStore=mySrvKeystore -Djavax.net.ssl.keyStorePassword=password ProxyServer
and enter in the address, port, and localport as
https://google.com 443 5000
And try accessing
localhost:5000
on my machine, then I get the error
java.net.UnknownHostException: https://google.com
After debugging, I am pretty sure it breaks in this code block when I try to create the SSLSocket (secureServer).
SSLSocket secureServer;
try {
SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
secureServer = (SSLSocket) factory.createSocket(host, port);
from_server = secureServer.getInputStream();
to_server = secureServer.getOutputStream();
}