To check to see if a task has completed invoke the TelnetTask#isCompleted method.
Example
// wait until task is complete
while(!task.isComplete()) {
Thread.sleep(100);
}