Skip to content

Instantly share code, notes, and snippets.

@tekbird tekbird/
Last active Nov 14, 2018

What would you like to do?
java ssl socket server
public static void main(String[] args) throws IOException {
System.setProperty("", "C:\\path\\to\\keystore\\store.jks");
System.setProperty("", "Password1");
SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
ServerSocket ss = ssf.createServerSocket(7000);
while (true) {
Socket s = ss.accept();
InputStreamReader reader = new InputStreamReader(s.getInputStream());
char[] chars = new char[10];;
System.out.println(new String(chars));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.