- String to = dis.readUTF();
- String subject = dis.readUTF();
- String message = dis.readUTF();
- String from = dis.readUTF();
- String replyto = dis.readUTF();
- mails.add(new TestMail(to, subject, message, from, replyto));
+ String type = dis.readUTF();
+ if (type.equals("mail")) {
+ String to = dis.readUTF();
+ String subject = dis.readUTF();
+ String message = dis.readUTF();
+ String from = dis.readUTF();
+ String replyto = dis.readUTF();
+ mails.add(new TestMail(to, subject, message, from, replyto));
+ } else if (type.equals("challengeAddrBox")) {
+ String email = dis.readUTF();
+ if (approveRegex.matcher(email).matches()) {
+ System.out.println("approving mbox: " + email);
+ dos.writeUTF("OK");
+ } else {
+ System.out.println("rejecting mbox: " + email);
+ dos.writeUTF("FAIL");
+ }
+ dos.flush();
+ } else if (type.equals("ping")) {
+ } else {
+ System.err.println("Unknown type: " + type);
+ }