I’m afraid that I cannot reproduce this problem. In a chat, you told me that you configure Openfire to use the “never kick” resource policy, as shown below:
I used the following code (that uses Smack) to test the behavior with Openfire 4.6.4, 4.6.7, 4.7.0 and 4.7.1. They all seem to behave in the same way. The second connection to try and login receives a “conflict - cancel” error.
import org.jivesoftware.smack.ConnectionConfiguration;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import java.time.Duration;
public class TestClientResourceConflict {
public static void main(String[] args) throws Exception {
XMPPTCPConnectionConfiguration configA = XMPPTCPConnectionConfiguration.builder()
.setUsernameAndPassword("john", "secret")
.setXmppDomain("example.org")
.setResource("test")
.setHost("localhost")
.setPort(5222)
.addEnabledSaslMechanism("PLAIN")
.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
.build();
XMPPTCPConnection connectionA = new XMPPTCPConnection(configA);
connectionA.setUseStreamManagement(false); // To reduce output in the debug log.
XMPPTCPConnection connectionB = new XMPPTCPConnection(configA);
connectionB.setUseStreamManagement(false); // To reduce output in the debug log.
connectionA.connect();
connectionA.login();
Thread.sleep(Duration.ofSeconds(2).toMillis());
connectionB.connect();
connectionB.login();
Thread.sleep(Duration.ofSeconds(2).toMillis());
connectionA.disconnect();
connectionB.disconnect();
}
}