1 package org.cacert.gigi.email;
3 import java.io.DataInputStream;
4 import java.io.DataOutputStream;
5 import java.io.IOException;
6 import java.net.InetAddress;
7 import java.net.ServerSocket;
8 import java.net.Socket;
9 import java.util.Properties;
11 class TestEmailProvider extends EmailProvider {
16 protected TestEmailProvider(Properties props) {
18 servs = new ServerSocket(Integer.parseInt(props
19 .getProperty("emailProvider.port")), 10,
20 InetAddress.getByName("127.0.0.1"));
21 } catch (IOException e) {
26 public synchronized void sendmail(String to, String subject,
27 String message, String from, String replyto, String toname,
28 String fromname, String errorsto, boolean extra) throws IOException {
30 assureLocalConnection();
40 } catch (IOException e) {
45 private void assureLocalConnection() throws IOException {
49 } catch (IOException e) {
53 if (client == null || client.isClosed()) {
54 client = servs.accept();
55 out = new DataOutputStream(client.getOutputStream());
56 in = new DataInputStream(client.getInputStream());
60 public synchronized String checkEmailServer(int forUid, String address)
63 assureLocalConnection();
65 out.writeUTF("challengeAddrBox");
66 out.writeUTF(address);
68 } catch (IOException e) {
74 private void write(String to) throws IOException {
76 out.writeUTF("<null>");