org.subethamail.smtp.test.util
Class Client

java.lang.Object
  extended by org.subethamail.smtp.test.util.Client

public class Client
extends java.lang.Object

A crude telnet client that can be used to send SMTP messages and test the responses.

Author:
Jeff Schnitzer, Jon Stevens

Constructor Summary
Client(java.lang.String host, int port)
          Establishes a connection to host and port.
 
Method Summary
 void close()
           
 void expect(java.lang.String expect)
          Throws an exception if the response does not start with the specified string.
protected  java.lang.String readResponse()
          Get the complete response, including a multiline response.
 void send(java.lang.String msg)
          Sends a message to the server, ie "HELO foo.example.com".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String host,
              int port)
       throws java.net.UnknownHostException,
              java.io.IOException
Establishes a connection to host and port.

Throws:
java.io.IOException
java.net.UnknownHostException
Method Detail

send

public void send(java.lang.String msg)
          throws java.lang.Exception
Sends a message to the server, ie "HELO foo.example.com". A newline will be appended to the message.

Throws:
an - exception if the method cannot send for any reason
java.lang.Exception

expect

public void expect(java.lang.String expect)
            throws java.lang.Exception
Throws an exception if the response does not start with the specified string.

Throws:
java.lang.Exception

readResponse

protected java.lang.String readResponse()
                                 throws java.lang.Exception
Get the complete response, including a multiline response. Newlines are included.

Throws:
java.lang.Exception

close

public void close()
           throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2009 SubEthaSMTP. All Rights Reserved. Build version: UNVERSIONED