Is it possible to change plain socket to SSLSocket?

Viewed 13253

There is a plain socket server listening on port 12345;

ServerSocket s = new ServerSocket(12345);

What I want to know is that it is possible that:

  1. If the client send a http request, the server handle the request directly,
  2. If the client send a https request, the server change client socket to SSLSocket?

Thanks

4 Answers
Related