4 import java.lang.Thread;
5 import java.security.*;
6 import javax.net.ssl.*;
8 import java.nio.file.FileSystems;
9 import java.nio.file.Path;
14 public static void main(String[] args)
16 String ksName = global.home+global.keyStoreName;
17 char ksPass[] = global.keyStorePass.toCharArray();
18 char ctPass[] = global.keyStorePass.toCharArray();
20 //thread di controllo directory esercizi
21 Path pathToWatch = FileSystems.getDefault().getPath(global.locationEsercizi);
22 DirectoryWatcher dirWatcher = new DirectoryWatcher(pathToWatch);
23 Thread dirWatcherThread = new Thread(dirWatcher);
24 dirWatcherThread.start();
26 //thread che si occupa del lato http
27 httpget regServer=new httpget();
28 Thread httpServer=new Thread(regServer);
35 KeyStore ks = KeyStore.getInstance("JKS");
36 ks.load(new FileInputStream(ksName), ksPass);
37 KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
39 SSLContext sc = SSLContext.getInstance("TLS");
40 sc.init(kmf.getKeyManagers(), null, null);
41 SSLServerSocketFactory ssf = sc.getServerSocketFactory();
42 SSLServerSocket s= (SSLServerSocket) ssf.createServerSocket(global.portaServer);
43 System.out.println("Server started:");
46 SSLSocket c = (SSLSocket) s.accept();
47 System.out.println("CSC: debug 1");
48 guestServer guest=new guestServer(c);
49 Thread t=new Thread(guest);