java ssl socket server
public static void main(String[] args) throws IOException { | |
System.setProperty("javax.net.ssl.keyStore", "C:\\path\\to\\keystore\\store.jks"); | |
System.setProperty("javax.net.ssl.keyStorePassword", "Password1"); | |
SSLServerSocketFactory ssf = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); | |
ServerSocket ss = ssf.createServerSocket(7000); | |
System.out.println("started"); | |
while (true) { | |
Socket s = ss.accept(); | |
System.out.println("connected"); | |
InputStreamReader reader = new InputStreamReader(s.getInputStream()); | |
char[] chars = new char[10]; | |
reader.read(chars); | |
System.out.println(new String(chars)); | |
s.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment