public void stopAndWaitForClientOnThread(long ms){
  if (clientRunningOnThread != null && clientRunningOnThread.isAlive()) {
    clientRunningOnThread.interrupt();
  }
  long start=System.currentTimeMillis();
  while ((System.currentTimeMillis() - start) < ms) {
    if (clientRunningOnThread != null && clientRunningOnThread.isAlive()) {
      try {
        clientRunningOnThread.join(ms - (System.currentTimeMillis() - start));
        break;
      }
 catch (      InterruptedException e) {
      }
    }
 else {
      break;
    }
  }
  if (clientRunningOnThread != null && clientRunningOnThread.isAlive()) {
    throw new AssertionError("clientRunningOnThread is alive even after waiting " + ms + "ms");
  }
}

public void stopAndWaitForClientOnThread ( long ms ) { if ( clientRunningOnThread != null && clientRunningOnThread . isAlive ( ) ) { clientRunningOnThread . interrupt ( ) ; } long start = System . currentTimeMillis ( ) ; while ( ( System . currentTimeMillis ( ) - start ) < ms ) { if ( clientRunningOnThread != null && clientRunningOnThread . isAlive ( ) ) { try { clientRunningOnThread . join ( ms - ( System . currentTimeMillis ( ) - start ) ) ; break ; } catch ( InterruptedException e ) { } } else { break ; } } if ( clientRunningOnThread != null && clientRunningOnThread . isAlive ( ) ) { throw new AssertionError ( "clientRunningOnThread is alive even after waiting " + ms + "ms" ) ; } }
only for debug reasons .
