+ return;
+ } catch (IOException e) {
+ client = null;
+ }
+ }
+ }
+ private void assureLocalConnection() throws IOException {
+ if (out != null) {
+ try {
+ out.writeUTF("ping");
+ } catch (IOException e) {
+ client = null;
+ }
+ }
+ if (client == null || client.isClosed()) {
+ client = servs.accept();
+ out = new DataOutputStream(client.getOutputStream());
+ in = new DataInputStream(client.getInputStream());
+ }
+ }
+ @Override
+ public synchronized String checkEmailServer(int forUid, String address)
+ throws IOException {
+ while (true) {
+ assureLocalConnection();
+ try {
+ out.writeUTF("challengeAddrBox");
+ out.writeUTF(address);
+ return in.readUTF();