Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;

public class EchoClient {
    public static void main(String[] args) {
        try {
            SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
            SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket("localhost", 9999);

  	    PrintWriter out = new PrintWriter(sslsocket.getOutputStream(), true);
	    BufferedReader in = new BufferedReader(new InputStreamReader(sslsocket.getInputStream()));
			
	    BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
            
	    String userInput;

	    while ((userInput = stdIn.readLine()) != null) {
		out.println(userInput);
		System.out.println(in.readLine());
	    }

	    out.close();
	    in.close();
	    stdIn.close();
	    sslsocket.close();		
        } 
	catch (Exception e) { 
	    /*Handle exception*/
	} 
    }
}

Risk assesment

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

 

medium

unlikely

low

P6

L2

References

Wiki Markup
\[[API 06|AA. Java References#API 06]\] 
\[[Ware 08|AA. Java References#Ware 08]\]