Examples of SRVRecord


Examples of io.vertx.core.dns.SrvRecord

      List<SrvRecord> result = ar.result();
      assertNotNull(result);
      assertFalse(result.isEmpty());
      assertEquals(1, result.size());

      SrvRecord record = result.get(0);

      assertEquals(priority, record.priority());
      assertEquals(weight, record.weight());
      assertEquals(port, record.port());
      assertEquals(target, record.target());

      testComplete();
    });
    await();
  }
View Full Code Here

Examples of net.java.sip.communicator.util.SRVRecord

        {
            return null;
        }

        //String[][] pvhn = new String[records.length][4];
        SRVRecord srvRecords[] = new SRVRecord[records.length];

        for (int i = 0; i < records.length; i++)
        {
            org.xbill.DNS.SRVRecord srvRecord =
                (org.xbill.DNS.SRVRecord) records[i];
            srvRecords[i] = new SRVRecord(srvRecord);
        }

        // Sort the SRV RRs by priority (lower is preferred) and weight.
        sortSrvRecord(srvRecords);
View Full Code Here

Examples of net.java.sip.communicator.util.SRVRecord

            SRVRecord[] srvRecords,
            int startIndex,
            int endIndex,
            int selectedWeight)
    {
        SRVRecord tmpSrvRecord;
        int totalPriorityWeight = 0;

        for(int i = startIndex; i < endIndex; ++i)
        {
            totalPriorityWeight += srvRecords[i].getWeight();
View Full Code Here

Examples of org.cipango.dns.record.SrvRecord

  }
 
  @Test
  public void testSrv() throws Exception
  {
    List<Record> records = _dnsService.lookup(new SrvRecord("sip", "udp", "cipango.org"));
    assertNotNull(records);
    assertEquals(1, records.size());
    //System.out.println(records);
    SrvRecord srvRecord = (SrvRecord) records.get(0);
    assertEquals(10, srvRecord.getPriority());
    assertEquals(60, srvRecord.getWeight());
    assertEquals(5060, srvRecord.getPort());
    assertEquals("cipango.org", srvRecord.getTarget().toString());
  }
View Full Code Here

Examples of org.cipango.dns.record.SrvRecord

    assertEquals(1, message.getAnswerSection().size());
    record = message.getAnswerSection().get(0);
    assertEquals(Type.SRV, record.getType());
    assertEquals("_sip._udp.cipango.org", record.getName().toString());
    assertEquals(DnsClass.IN, record.getDnsClass());
    SrvRecord srvRecord = (SrvRecord) record;
    assertEquals(10, srvRecord.getPriority());
    assertEquals(60, srvRecord.getWeight());
    assertEquals(5060, srvRecord.getPort());
    assertEquals("cipango.org", srvRecord.getTarget().toString());
  }
View Full Code Here

Examples of org.jivesoftware.smack.util.dns.SRVRecord

                    double rnd = Math.random() * running_total;
                    selectedPos = bisect(totals, rnd);
                }
                // add the SRVRecord that was randomly chosen on it's weight
                // to the start of the result list
                SRVRecord chosenSRVRecord = bucket.remove(selectedPos);
                res.add(chosenSRVRecord);
            }
        }

        return res;
View Full Code Here

Examples of org.xbill.DNS.SRVRecord

        List<ResolvedAddress> addresses = new ArrayList<ResolvedAddress>();
        try {
            Record[] records = new Lookup("_xmpp-server._tcp." + domain, Type.SRV).run();
            if(records != null) {
                for (int i = 0; i < records.length; i++) {
                    SRVRecord srv = (SRVRecord) records[i];
                    addresses.add(new ResolvedAddress(srv.getTarget(), srv.getPort(), srv.getPriority()));
                }
               
                // sort by priority
                Collections.sort(addresses, new Comparator<ResolvedAddress>() {
                    public int compare(ResolvedAddress a1, ResolvedAddress a2) {
View Full Code Here

Examples of org.xbill.DNS.SRVRecord

    public SrvComparator() {
    }

    public int compare(Object o1, Object o2) {
        SRVRecord rec1 = (SRVRecord) o1;
        SRVRecord rec2 = (SRVRecord) o2;
        int comparison = comparePriority(rec1, rec2);

        if (comparison != compEQUAL) {
            return comparison;
        }
View Full Code Here

Examples of org.xbill.DNS.SRVRecord

            int[] priorityGroupBoundaries = new int[records.length];
            int lastPrio = -1;
            int prioIndex = 0;

            for (int i = 0; i < records.length; i++) {
                SRVRecord srv = (SRVRecord) records[i];

                if (srv.getPriority() != lastPrio) {
                    lastPrio = srv.getPriority();
                    deltaSum = 0;
                    priorityGroupBoundaries[prioIndex] = i;
                    prioIndex++;
                    numPriorityGroups++;
                }

                deltaSum += srv.getWeight();
                runningSum[i] = deltaSum;

                //
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE,
                        "SRVRecord.toString():" + srv.toString());
                }

                /*
                 * logger.log(Level.FINE, "SRVRecord.toString():" + srv.toString());
                 * //logger.log(Level.FINE, "Host " + srv.getTarget());
View Full Code Here

Examples of org.xbill.DNS.SRVRecord

        int maxValue = runningSum[lastIndex] + 1;
        int testValue = getRandomIndex(maxValue);
        int ignoreIndex = -1;

        for (int i = firstIndex; i < (lastIndex + 1); i++) {
            SRVRecord srv = (SRVRecord) records[i];

            // logger.log(Level.FINE, "SRVRecord.toString():" + srv.toString());
            if (runningSum[i] >= testValue) {
                // this is it
                if (logger.isLoggable(Level.FINE)) {
                    logger.log(Level.FINE, "found srv:" + srv.toString());
                }

                TargetTuple targetTuple =
                        lookupNameFromSRV(srv, theProtocol);
                if(targetTuple != null){
                    return targetTuple;
                }
                else{
                    ignoreIndex = i;
                }
            }
        }
        //Since selective lookup failed, iterate over complete list
        for (int i = firstIndex; i < (lastIndex + 1); i++) {
            if(i == ignoreIndex){
                continue;
            }
            SRVRecord srv = (SRVRecord) records[i];

            TargetTuple targetTuple =
                        lookupNameFromSRV(srv, theProtocol);
            if(targetTuple != null){
                return targetTuple;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.