public void run() {
   while (true) {
     try {
       String msg = streamIn.readUTF();
       client.handle(AES.decrypt(msg, enc_key));
     } catch (IOException ioe) {
       JOptionPane.showMessageDialog(
           null, ioe.getMessage(), "Listening Error!", JOptionPane.ERROR_MESSAGE);
       client.stop();
     } catch (Exception ex) {
       JOptionPane.showMessageDialog(null, ex.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
       client.stop();
     }
   }
 }
 public void open() {
   try {
     streamIn = new DataInputStream(socket.getInputStream());
   } catch (IOException ioe) {
     JOptionPane.showMessageDialog(
         null, ioe.getMessage(), "Error getting input stream: ", JOptionPane.ERROR_MESSAGE);
     client.stop();
   }
 }