// The thread which listens for server responses
 public void listenForIncoming() {
   while (isConnected()) {
     try {
       String n = bReader.readLine();
       if (n == null) {
         close(); // the server disconnected us
         System.out.println("N WAS NULL");
         continue;
       }
       recieved.add(n);
       try {
         Thread.sleep(10);
       } catch (Exception e) {
       }
     } catch (Exception e) {
       e.printStackTrace();
       close(); // stream error
       // break;
     }
   }
 }
 // sends a line to the output buffer to be sent to the server.
 public void sendLine(String n) {
   toSend.add((n + "\r\n").getBytes());
 }
 // add event to be procesed by this thread
 public void addEvent(PluginMethod e) {
   events.add(e);
 }