Пример #1
0
 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
 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));
   }
 }