예제 #1
0
파일: Main.java 프로젝트: beroal/forum
 Main(MyDb myDb, int port)
     throws ClassNotFoundException, SQLException, IOException, KeyStoreException,
         NoSuchAlgorithmException, UnrecoverableKeyException, CertificateException {
   this.myDb = myDb;
   this.port = port;
   db = myDb.create();
   defaultKmf = DefaultKmf.get();
   fingTable = new FingTable();
   userInputThread = new UserInputThread(fingTable);
   netNodeTable = new NetNodeTable(new FedThreadFactory(defaultKmf, myDb), myDb.create());
 }
예제 #2
0
파일: Main.java 프로젝트: beroal/forum
 void main1() throws SQLException, IOException, KeyManagementException, NoSuchAlgorithmException {
   netNodeTable.connectToFedAll();
   SSLContext context = SSLContext.getInstance("TLS");
   context.init(
       defaultKmf.getKeyManagers(), new TrustManager[] {new AnyClientTrustManager()}, null);
   SSLServerSocket serverSocket =
       (SSLServerSocket) context.getServerSocketFactory().createServerSocket(port);
   serverSocket.setNeedClientAuth(true);
   userInputThread.start();
   while (true) {
     SSLSocket clientSocket = (SSLSocket) serverSocket.accept();
     fingTable.addAndStart(new FingThread(myDb.create(), netNodeTable, fingTable, clientSocket));
   }
 }