|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectMailServerSimulator
public class MailServerSimulator
This class simulates the message sending and delivery actions of an email server. A limited number of received message are simulated (about 15). After they are delivered, the server will not deliver additional messages. (You are encouraged to simulate previously received/composed messages. These messages will simulate past use of the program.)
Some messages are SPAM, some are not sent to the user specifically (i.e., sent via a mailing list), and some belong to a common thread of discussion; handle these as you see fit.
This class also simulates incorrect logins, connection problems, and slow connections. Your GUI program should gracefully accomodate such issues.
| Nested Class Summary | |
|---|---|
static class |
MailServerSimulator.IncorrectLoginException
This exception is thrown to simulate a login attempt with incorrect credentials. |
static class |
MailServerSimulator.Message
This class encapsulates a mail message from the simulated mail server. |
static class |
MailServerSimulator.UnableToConnectException
This exception is thrown to simulate a problem connecting to the server. |
| Constructor Summary | |
|---|---|
MailServerSimulator(java.lang.String username)
Initializes the simulator. |
|
| Method Summary | |
|---|---|
MailServerSimulator.Message[] |
getNewMessages(java.lang.String password)
Returns an array of (new) messages from the server. |
java.lang.String |
getPassword()
Returns the current password. |
boolean |
sendMessage(java.lang.String from,
java.lang.String to,
java.lang.String cc,
java.lang.String bcc,
java.util.Date date,
java.lang.String subject,
java.lang.String body)
Simulates sending of an email message. |
boolean |
setPassword(java.lang.String newPassword)
Sets the password for the mail account. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MailServerSimulator(java.lang.String username)
username - the recipient's username| Method Detail |
|---|
public java.lang.String getPassword()
public boolean setPassword(java.lang.String newPassword)
newPassword - the new password
public boolean sendMessage(java.lang.String from,
java.lang.String to,
java.lang.String cc,
java.lang.String bcc,
java.util.Date date,
java.lang.String subject,
java.lang.String body)
throws MailServerSimulator.UnableToConnectException
from - the sender informationto - the recipient informationcc - the carbon-copy informationbcc - the blind carbon-copy informationdate - the timestamp informationsubject - the subject informationbody - the message body
MailServerSimulator.UnableToConnectException
public MailServerSimulator.Message[] getNewMessages(java.lang.String password)
throws MailServerSimulator.IncorrectLoginException,
MailServerSimulator.UnableToConnectException
password - the password for the account
MailServerSimulator.IncorrectLoginException
MailServerSimulator.UnableToConnectException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||