FileDocCategorySizeDatePackage
SSLSimpleServer.javaAPI DocExample1108Mon Jan 15 12:02:36 GMT 2001javasec.samples.ch14

SSLSimpleServer

public class SSLSimpleServer extends Thread

Fields Summary
private Socket
sock
Constructors Summary
public SSLSimpleServer(Socket s)

        sock = s;
    
Methods Summary
public static voidmain(java.lang.String[] args)

        ServerSocketFactory ssf = SSLServerSocketFactory.getDefault();
        ServerSocket ss = ssf.createServerSocket(9096);

        System.out.println("Ready...");
        while (true) {
            new SSLSimpleServer(ss.accept()).start();
        }
    
public voidrun()

        try {
            BufferedReader br = new BufferedReader(
                                    new InputStreamReader(
                                        sock.getInputStream()));
            PrintWriter pw = new PrintWriter(sock.getOutputStream());

            String data = br.readLine();
            pw.println("What is she?");
            pw.close();
            sock.close();
        } catch (IOException ioe) {
            // Client disconnected
        }