Ejemplo n.º 1
0
 protected synchronized List<ReplyLine> sendAndWaitForResponse(String s, String rest)
     throws IOException {
   checkThread();
   Waiter w = new Waiter();
   if (debugOutput != null) debugOutput.print(">> " + s);
   synchronized (waiters) {
     output.write(s);
     if (rest != null) writeEscaped(rest);
     output.flush();
     waiters.addLast(w);
   }
   List<ReplyLine> lst = w.getResponse();
   for (Iterator<ReplyLine> i = lst.iterator(); i.hasNext(); ) {
     ReplyLine c = i.next();
     if (!c.status.startsWith("2")) throw new TorControlError("Error reply: " + c.msg);
   }
   return lst;
 }