The SSLClient Class

The SSLClient class is used to demonstrate the SSL server program shown previously. This class uses the JSSE package to create a SSLSocket, a client socket that connects to the server socket specified.

The work required to create the SSLSocket is performed in the constructor of the class. In the main program block, the no-arg constructor for the SSLClient class is called. The reference returned contains a reference to the SSLSocketFactory class which is used to make a call to the createSocket method. This method returns a SSLSocket opened on port 1500 on the host localhost.

Unlike the standard java.net Socket, the SSLSocket must start the handshaking process that will initiate SSL security. This is done with a call to the ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.