使用 Smack 4.1 创建新组时获取 SmackException NoResponseException

Getting SmackException NoResponseException while creating a new group using Smack 4.1

我正在使用下面的代码创建多用户组,但出现超时错误,即使我的超时错误是 10 秒。

public void createGroup() {

    String roomId = "Group_test003" + "@icoveri.com";
    String nick = "Grouptest";

    try {

        MultiUserChatManager manager = multiUserChatManager.getInstanceFor(connection);

        MultiUserChat muc = manager.getMultiUserChat(roomId);

        muc.create(nick);

        Form form = muc.getConfigurationForm();

        Form submitForm = form.createAnswerForm();

        List<FormField> fields = form.getFields();
        for (int i = 0; i < fields.size(); i++) {
            FormField field = (FormField) fields.get(i);
            if (!FormField.Type.hidden.equals(field.getType()) && field.getVariable() != null) {

                submitForm.setDefaultAnswer(field.getVariable());
            }
        }

        List owners = new ArrayList();
        owners.add(user1234 + "@icoveri.com");
        submitForm.setAnswer("muc#roomconfig_roomowners", owners);

        muc.sendConfigurationForm(submitForm);

    } catch (XMPPException e) {
        e.printStackTrace();
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
    } catch (SmackException.NotConnectedException e) {
        e.printStackTrace();
    } catch (SmackException e) {
        e.printStackTrace();
    }

}

我得到的错误是

org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 10000ms (~10s). Used filter: AndFilter: (FromMatchesFilter (full): Group_test003@iscoveri.com/Grouptest, StanzaTypeFilter: org.jivesoftware.smack.packet.Presence).

at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:229) at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:311) at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:400) at org.jivesoftware.smackx.muc.MultiUserChat.createOrJoin(MultiUserChat.java:376)

我找到了解决办法。问题出在我的服务中,即 iscoveri.com。我不得不使用不同的服务名称来创建群组。

我也花了几个小时试图纠正同样的错误;就我而言,问题发生在我使用 XMPPBOSHConnection 时,但在使用 XMPPTCPConnection.

时却没有