AnsweredAssumed Answered

No response received within reply timeout when i create a multiuserchat,but i can send message!

Question asked by flyJocker on Jun 10, 2015
Latest reply on Jun 10, 2015 by flyJocker

this is my code:

public class SmackTest {
private static AbstractXMPPConnection conn;
private static XMPPTCPConnectionConfiguration config;
private final static String USER_NAME = "root";
private final static String USER_PASSWORD = "root";
private final static String SERVICE_HOST = "localhost";
private final static int SERVICE_PORT = 5222;
private final static String SERVICE_NAME = "flyjocker-pc-openfire-server";

public void connect(){
  try {
//   SASLMechanism mechanism = new SASLDigestMD5Mechanism();
//   SASLAuthentication.registerSASLMechanism(mechanism);
//   SASLAuthentication.blacklistSASLMechanism("SCRAM-SHA-1"); 
//   SASLAuthentication.unBlacklistSASLMechanism("DIGEST-MD5");

   XMPPTCPConnectionConfiguration.Builder builder = XMPPTCPConnectionConfiguration.builder();
   builder.setSecurityMode(XMPPTCPConnectionConfiguration.SecurityMode.disabled);
   builder.setHost(SERVICE_HOST);
   builder.setPort(SERVICE_PORT);
   builder.setUsernameAndPassword(USER_NAME, USER_PASSWORD);
   builder.setDebuggerEnabled(true);
   builder.setServiceName(SERVICE_NAME);
   config = builder.build();
   conn = new XMPPTCPConnection(config);
   conn.connect();
  } catch (SmackException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  } catch (XMPPException e) {
   e.printStackTrace();
  }
}

@Test
public void createRoom() {
  try {
   connect();
   conn.login();
   MultiUserChat multiUserChat = MultiUserChatManager.getInstanceFor(conn).getMultiUserChat("demo@pinpoint.flyjocker-pc-openfire-server");
   multiUserChat.create("demo");
   multiUserChat.sendConfigurationForm(new Form(DataForm.Type.submit));
   conn.disconnect();
  } catch (NoResponseException ex) {
   ex.printStackTrace();
  } catch (XMPPErrorException ex) {
   ex.printStackTrace();
  } catch (NotConnectedException ex) {
   ex.printStackTrace();
  } catch (SmackException ex) {
   ex.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  } catch (XMPPException e) {
   e.printStackTrace();
  }
}

public void sendMessage() {
  try {
   connect();
   conn.login();
   Chat chat = ChatManager.getInstanceFor(conn).createChat("flyJocker@flyjocker-pc-openfire-server", new ChatMessageListener() {
    @Override
    public void processMessage(Chat chat, Message message) {
    
    }
   });
   chat.sendMessage("Howdy!");
   conn.disconnect();
  } catch (NotConnectedException e) {
   e.printStackTrace();
  } catch (XMPPException e) {
   e.printStackTrace();
  } catch (SmackException e) {
   e.printStackTrace();
  } catch (IOException e) {
   e.printStackTrace();
  }
}
}

Outcomes