May 2001
Intermediate to advanced
1088 pages
30h 13m
English
It's even easier to convert a client program to SSL because you don't need to worry about the key store. You just create an SSLSocketFactory and ask the factory to create an SSLSocket object.
Listing 35.5 shows an excerpt from the ChatClient class from Chapter 27.
try
{
// Connect to the server
Socket sock = new Socket(host, portNumber);
|
Listing 35.6 shows the SSL version of the same section of code.
try
{
// Connect to the server
SSLSocketFactory sslFactory =
(SSLSocketFactory) SSLSocketFactory.getDefault();
SSLSocket sock = (SSLSocket) sslFactory.
createSocket(host, portNumber);
|
Once again, the ...
Read now
Unlock full access