Example #1
0
 private void go() {
   try {
     // Read as long as there is input
     byte[] buffer = new byte[ciphertextBlockSize];
     boolean disconnectMsgSent = false;
     while (connection != null && !disconnectMsgSent && input.read(buffer) != -1) {
       // Decipher the bytes read in
       byte[] plaintext = Ciphers.RSADecipherWSalt(buffer, decipherExp, modulus);
       if (plaintext.length == 1 && plaintext[0] == 0) {
         disconnectMsgSent = true;
         closeAll();
       } else {
         // convert to a string and display
         message = new String(plaintext);
         displayArea.append("\n" + message);
       }
     }
   } catch (IOException ioe) {
     // Server disconnected-we can reconnect if we wish
   }
 }