@Test
public void resolveSorted()
{

  final SRVDNSResolver resolver = new SRVDNSResolver(contextFactory);
  final Set<SRVRecord> records = resolver.resolve("_ldap._tcp.sorted.ldaptive.org");
  Assert.assertEquals(records.size(), 3);
  final Iterator<SRVRecord> i = records.iterator();
  int count = 0;
  while (i.hasNext()) {
    final SRVRecord record = i.next();
    if (count == 0) {
      Assert.assertEquals(record.getTarget(), "curly.ldaptive.org");
      Assert.assertEquals(record.getPriority(), 1);
      Assert.assertEquals(record.getWeight(), 0);
    } else if (count == 1) {
      Assert.assertEquals(record.getTarget(), "moe.ldaptive.org");
      Assert.assertEquals(record.getPriority(), 3);
      Assert.assertEquals(record.getWeight(), 200);
    } else if (count == 2) {
      Assert.assertEquals(record.getTarget(), "larry.ldaptive.org");
      Assert.assertEquals(record.getPriority(), 5);
      Assert.assertEquals(record.getWeight(), 100);
    } else {
      throw new IllegalStateException("Unknown index:" + count);
    }
    count++;
  }
}