try {
muc3.join("MyNick");
fail("Other user was able to join with other user's reserved nickname");
}
catch (XMPPException e) {
XMPPError xmppError = e.getXMPPError();
assertNotNull(
"No XMPPError was received when joining with other user's reserved nickname",
xmppError);
assertEquals(
"Different error code was received while joining with other user's reserved nickname",
409,
xmppError.getCode());
}
// Check that user3 can join the room using his own nickname (not reserved)
muc3.join("MyNotReservedNick");
muc3.leave();
// Check that another user cannot reserve an already reserved nickname
registrationForm = muc3.getRegistrationForm();
answerForm = registrationForm.createAnswerForm();
answerForm.setAnswer("muc#register_first", "MyFirstName 2");
answerForm.setAnswer("muc#register_last", "MyLastName 2");
answerForm.setAnswer("muc#register_roomnick", "MyNick");
try {
muc3.sendRegistrationForm(answerForm);
}
catch (XMPPException e) {
XMPPError xmppError = e.getXMPPError();
assertNotNull(
"No XMPPError was received when reserving an already reserved nickname",
xmppError);
assertEquals(
"Different error code was received while reserving an already reserved nickname",
409,
xmppError.getCode());
}
// Check that another user can reserve a new nickname
registrationForm = muc3.getRegistrationForm();
answerForm = registrationForm.createAnswerForm();