Пример #1
0
 public void run() {
   try {
     while (_expect.size() > 0) {
       assertEquals(_expect.remove(0), _incoming.readLine());
       if (_send.size() > 0) {
         String tosend = _send.remove(0);
         if (tosend != null) {
           for (String s : tosend.split("\n")) {
             _outgoing.println(s);
           }
         }
       }
     }
   } catch (Throwable t) {
     if (_throwable == null) {
       _throwable = t;
     }
   } finally {
     try {
       _control.close();
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
   }
 }
Пример #2
0
 public void run() {
   try {
     String l;
     while ((l = _incoming.readLine()) != null) {
       _last = l;
       Thread.sleep(_delay);
     }
   } catch (Throwable t) {
     if (_throwable == null) {
       _throwable = t;
     }
   } finally {
     try {
       _control.close();
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
   }
 }