X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftesi%2Fsrc%2Fcom%2Fcompany%2FsuperServer.java;fp=server%2Ftesi%2Fsrc%2Fcom%2Fcompany%2FsuperServer.java;h=0000000000000000000000000000000000000000;hb=bd7a266f1a37cb373614b8fa3d0c1e832c4b82e3;hp=d755d9c77129707af1a4af55258cbdc145dfa4fe;hpb=edfa62efb21b128dce6de134a3fb0d85f77bd2b8;p=logicplayer.git diff --git a/server/tesi/src/com/company/superServer.java b/server/tesi/src/com/company/superServer.java deleted file mode 100644 index d755d9c..0000000 --- a/server/tesi/src/com/company/superServer.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.company; - -import java.io.*; -import java.lang.Thread; -import java.security.*; -import javax.net.ssl.*; - -import java.nio.file.FileSystems; -import java.nio.file.Path; - - -class superServer -{ - public static void main(String[] args) - { - String ksName = global.home+global.keyStoreName; - char ksPass[] = global.keyStorePass.toCharArray(); - char ctPass[] = global.keyStorePass.toCharArray(); - - //thread di controllo directory esercizi - Path pathToWatch = FileSystems.getDefault().getPath(global.locationEsercizi); - DirectoryWatcher dirWatcher = new DirectoryWatcher(pathToWatch); - Thread dirWatcherThread = new Thread(dirWatcher); - dirWatcherThread.start(); - - //thread che si occupa del lato http - httpget regServer=new httpget(); - Thread httpServer=new Thread(regServer); - httpServer.start(); - - while(true) - { - try - { - KeyStore ks = KeyStore.getInstance("JKS"); - ks.load(new FileInputStream(ksName), ksPass); - KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509"); - kmf.init(ks, ctPass); - SSLContext sc = SSLContext.getInstance("TLS"); - sc.init(kmf.getKeyManagers(), null, null); - SSLServerSocketFactory ssf = sc.getServerSocketFactory(); - SSLServerSocket s= (SSLServerSocket) ssf.createServerSocket(global.portaServer); - System.out.println("Server started:"); - while(true) - { - SSLSocket c = (SSLSocket) s.accept(); - System.out.println("CSC: debug 1"); - guestServer guest=new guestServer(c); - Thread t=new Thread(guest); - t.start(); - } - } - catch (Exception e) - { - e.printStackTrace(); - } - } - } -}