keyStoreFile.getCanonicalPath());
}
}
public void testPop() throws Exception {
final Client client = new Client(Protocol.POP);
client.getContext().getParameters().add("debug", DEBUG);
Request request = new Request(Method.GET, YAHOO_POP);
final ChallengeResponse challengeResponse = new ChallengeResponse(
ChallengeScheme.POP_BASIC, YAHOO_ID, YAHOO_PASSWORD);
request.setChallengeResponse(challengeResponse);
Response response = client.handle(request);
assertEquals(Status.SUCCESS_OK, response.getStatus());
// Send a new mail.
testSmtp();
// Try to get then delete the first message, if it exists.
if (response.isEntityAvailable()) {
final DomRepresentation representation = new DomRepresentation(
response.getEntity());
final NodeList nodes = representation.getNodes("/emails/email");
if (nodes.getLength() > 0) {
final Node node = representation
.getNode("/emails/email[1]/@href");
final String mailUrl = YAHOO_POP + node.getNodeValue();
request = new Request(Method.GET, mailUrl);
request.setChallengeResponse(challengeResponse);
response = client.handle(request);
assertEquals(Status.SUCCESS_OK, response.getStatus());
request = new Request(Method.DELETE, mailUrl);
request.setChallengeResponse(challengeResponse);
response = client.handle(request);
assertEquals(Status.SUCCESS_OK, response.getStatus());
}
}
client.stop();
}