// Stop the thread.
@Override
  public void close() {
    // Stop the thread.
    interrupt();
    // After the interrupt, the run() method will stop Tun2Socks, and then complete.
    // We need to wait until that is finished before closing the TUN device.
    try {
      join();
    } catch (InterruptedException e) {
      // This is weird: the calling thread has _also_ been interrupted.
      LogWrapper.report(e);
    }
    try {
      tunFd.close();
    } catch (IOException e) {
      LogWrapper.report(e);
    }
  }
@Override
public void close() {
// Stop the thread.
interrupt();
// After the interrupt, the run() method will stop Tun2Socks, and then complete.
@Override
public void close() {
// Stop the thread.
interrupt();
// After the interrupt, the run() method will stop Tun2Socks, and then complete.
// We need to wait until that is finished before closing the TUN device.
try {
join();
} catch (InterruptedException e) {
// This is weird: the calling thread has _also_ been interrupted.
LogWrapper.report(e);
}
try {
@Override
public void close() {
// Stop the thread.
interrupt();
// After the interrupt, the run() method will stop Tun2Socks, and then complete.
// We need to wait until that is finished before closing the TUN device.
try {
join();
} catch (InterruptedException e) {
// This is weird: the calling thread has _also_ been interrupted.
LogWrapper.report(e);
}
try {
tunFd.close();
} catch (IOException e) {
LogWrapper.report(e);
}
}