public void testLoginObtainsPasswordAuthentication() throws Exception {
DummySimpleClientListener listener =
new DummySimpleClientListener(
new PasswordAuthentication("guest", password));
SimpleClient client = new SimpleClient(listener);
int port = 5383;
Properties props =
createProperties(
"host", "localhost",
"port", Integer.toString(port),
"connectTimeout", Long.toString(TIMEOUT));
SimpleServer server = new SimpleServer(port);
try {
server.start();
client.login(props);
synchronized (client) {
client.wait(TIMEOUT);
}
assertEquals(1, listener.loggedInCount);
assertEquals(1, listener.getPasswordAuthentication);
client.logout(false);
synchronized (client) {
client.wait(TIMEOUT);
}
assertTrue(listener.disconnected);
assertTrue(listener.disconnectGraceful);
client.login(props);
synchronized (client) {
client.wait(TIMEOUT);
}
assertEquals(2, listener.loggedInCount);
assertEquals(2, listener.getPasswordAuthentication);
} finally {