mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Use Jid (and subclasses) from jxmpp-jid
Fixes SMACK-634
This commit is contained in:
parent
0ee2d9ed1e
commit
5bb4727c57
180 changed files with 1510 additions and 1032 deletions
|
@ -74,6 +74,8 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
import org.jivesoftware.smack.util.TLSUtils;
|
||||
import org.jivesoftware.smack.util.dns.HostAddress;
|
||||
import org.jxmpp.jid.impl.JidCreate;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
import org.jxmpp.util.XmppStringUtils;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
@ -290,8 +292,9 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
*
|
||||
* @param jid the bare JID used by the client.
|
||||
* @param password the password or authentication token.
|
||||
* @throws XmppStringprepException
|
||||
*/
|
||||
public XMPPTCPConnection(CharSequence jid, String password) {
|
||||
public XMPPTCPConnection(CharSequence jid, String password) throws XmppStringprepException {
|
||||
this(XmppStringUtils.parseLocalpart(jid.toString()), password, XmppStringUtils.parseDomain(jid.toString()));
|
||||
}
|
||||
|
||||
|
@ -305,10 +308,11 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
* @param username
|
||||
* @param password
|
||||
* @param serviceName
|
||||
* @throws XmppStringprepException
|
||||
*/
|
||||
public XMPPTCPConnection(CharSequence username, String password, String serviceName) {
|
||||
public XMPPTCPConnection(CharSequence username, String password, String serviceName) throws XmppStringprepException {
|
||||
this(XMPPTCPConnectionConfiguration.builder().setUsernameAndPassword(username, password).setServiceName(
|
||||
serviceName).build());
|
||||
JidCreate.domainBareFrom(serviceName)).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -728,7 +732,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection {
|
|||
final HostnameVerifier verifier = getConfiguration().getHostnameVerifier();
|
||||
if (verifier == null) {
|
||||
throw new IllegalStateException("No HostnameVerifier set. Use connectionConfiguration.setHostnameVerifier() to configure.");
|
||||
} else if (!verifier.verify(getServiceName(), sslSocket.getSession())) {
|
||||
} else if (!verifier.verify(getServiceName().toString(), sslSocket.getSession())) {
|
||||
throw new CertificateException("Hostname verification of certificate failed. Certificate does not authenticate " + getServiceName());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.tcp.XMPPTCPConnection.PacketWriter;
|
||||
import org.junit.Test;
|
||||
import org.jxmpp.stringprep.XmppStringprepException;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
|
@ -41,10 +42,11 @@ public class PacketWriterTest {
|
|||
* @throws InterruptedException
|
||||
* @throws BrokenBarrierException
|
||||
* @throws NotConnectedException
|
||||
* @throws XmppStringprepException
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
@Test
|
||||
public void shouldBlockAndUnblockTest() throws InterruptedException, BrokenBarrierException, NotConnectedException {
|
||||
public void shouldBlockAndUnblockTest() throws InterruptedException, BrokenBarrierException, NotConnectedException, XmppStringprepException {
|
||||
XMPPTCPConnection connection = new XMPPTCPConnection("user", "pass", "example.org");
|
||||
final PacketWriter pw = connection.new PacketWriter();
|
||||
connection.packetWriter = pw;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue