synchronized void complete() { agent.removeMessageListener(this); agent.removeConnectionListener(this); done = true; notifyAll(); }