this.communicationThread.join(timeout); // Set the timeout
timeout -= (System.currentTimeMillis() - start); // Set the run time!
if (timeout <= 0) { // The send thread did not end, timeout reasons
this.communicationThread.interrupt();
throw new ConnectionTimeoutException("Timeout occured. Timeout Default: " + _timeout + "ms, Exceeded time: " + (timeout < 0 ? -timeout : timeout) + "ms.");
}
} else {
this.communicationThread.join();
}