mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-21 22:02:06 +01:00
Fix DNSUtil.setDaneProvider()
Fixes SMACK-820.
This commit is contained in:
parent
9e865fe6ab
commit
37b5260cdd
2 changed files with 17 additions and 1 deletions
|
@ -72,7 +72,7 @@ public class DNSUtil {
|
|||
* @param daneProvider
|
||||
*/
|
||||
public static void setDaneProvider(SmackDaneProvider daneProvider) {
|
||||
daneProvider = Objects.requireNonNull(daneProvider);
|
||||
DNSUtil.daneProvider = Objects.requireNonNull(daneProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,8 @@ package org.jivesoftware.smack.util;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.jivesoftware.smack.util.DNSUtil.DomainType;
|
||||
import org.jivesoftware.smack.util.dns.SmackDaneProvider;
|
||||
import org.jivesoftware.smack.util.dns.SmackDaneVerifier;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -33,4 +35,18 @@ public class DnsUtilTest {
|
|||
assertEquals(DNSUtil.XMPP_SERVER_DNS_SRV_PREFIX, server.srvPrefix.ace);
|
||||
}
|
||||
|
||||
private static final SmackDaneProvider DNS_UTIL_TEST_DANE_PROVIDER = new SmackDaneProvider() {
|
||||
@Override
|
||||
public SmackDaneVerifier newInstance() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
};
|
||||
|
||||
@Test
|
||||
public void daneProviderTest() {
|
||||
DNSUtil.setDaneProvider(DNS_UTIL_TEST_DANE_PROVIDER);
|
||||
SmackDaneProvider currentDaneProvider = DNSUtil.getDaneProvider();
|
||||
|
||||
assertEquals(DNS_UTIL_TEST_DANE_PROVIDER, currentDaneProvider);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue