factory.add("valid", new MockMailbox(identifier, MESSAGE1, MESSAGE2));
server = createServer(createProtocol(factory), address);
server.bind();
POP3Client client = createClient();
client.connect(address.getAddress().getHostAddress(), address.getPort());
assertNull(client.listMessages());
assertNull(client.listUniqueIdentifiers());
assertFalse(client.deleteMessage(1));
assertNull(client.retrieveMessage(1));
assertNull(client.retrieveMessageTop(1, 10));
assertNull(client.status());
assertFalse(client.reset());
client.logout();
client.connect(address.getAddress().getHostAddress(), address.getPort());
assertTrue(client.login("valid", "valid"));
assertNotNull(client.listMessages());
assertNotNull(client.listUniqueIdentifiers());
Reader reader = client.retrieveMessage(1);
assertNotNull(reader);
reader.close();
assertNotNull(client.status());
reader = client.retrieveMessageTop(1, 1);
assertNotNull(reader);
reader.close();
assertTrue(client.deleteMessage(1));
assertTrue(client.reset());
assertTrue(client.logout());
} finally {
if (server != null) {
server.unbind();
}