To use secure sockets layer (SSL) with your existing code, you must first change your code to use socket factories.
To change your code to use socket factories, perform the following steps:
When you have completed all of these steps, your code uses socket factories. You do not need to make any other changes to your code. All of the methods that you call and all the syntax with your sockets still work.
See Examples: Change your Java™ code to use server socket factories for an example of a client program being converted to use socket factories.
See Example: Change your Java code to use client socket factories for an example of a client program being converted to use socket factories.