Examples of ICENegociator


Examples of de.javawi.jstun.test.demo.ice.ICENegociator

    public void initialize() {
        if (!isResolving() && !isResolved()) {
            System.out.println("Initialized");

            iceNegociator = new ICENegociator((short) 1, server, port);
            // gather candidates
            iceNegociator.gatherCandidateAddresses();
            // priorize candidates
            iceNegociator.prioritizeCandidates();
View Full Code Here

Examples of de.javawi.jstun.test.demo.ice.ICENegociator

        String first = "";

        for (int i = 0; i < 100; i++) {

            ICENegociator cc = new ICENegociator((short) 1);
            // gather candidates
            cc.gatherCandidateAddresses();
            // priorize candidates
            cc.prioritizeCandidates();
            // get SortedCandidates

            for (Candidate candidate : cc.getSortedCandidates()) {
                short nicNum = 0;
        try {
          Enumeration<NetworkInterface> nics = NetworkInterface.getNetworkInterfaces();
          short tempNic = 0;
          NetworkInterface nic = NetworkInterface.getByInetAddress(candidate.getAddress().getInetAddress());
          while(nics.hasMoreElements()) {
            NetworkInterface checkNIC = nics.nextElement();
            if (checkNIC.equals(nic)) {
              nicNum = tempNic;
              break;
            }
            i++;
          }
        } catch (SocketException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        }
                try {
                    TransportCandidate transportCandidate = new ICECandidate(candidate.getAddress().getInetAddress()
                            .getHostAddress(), 1, nicNum, "1", candidate.getPort(), "1", candidate.getPriority(),
                            ICECandidate.Type.prflx);
                    transportCandidate.setLocalIp(candidate.getBase().getAddress().getInetAddress().getHostAddress());
                    System.out.println("C: " + candidate.getAddress().getInetAddress() + "|"
                            + candidate.getBase().getAddress().getInetAddress() + " p:" + candidate.getPriority());
                } catch (UtilityException e) {
                    e.printStackTrace();
                } catch (UnknownHostException e) {
                    e.printStackTrace();
                }
            }
            Candidate candidate = cc.getSortedCandidates().get(0);
            String temp = "C: " + candidate.getAddress().getInetAddress() + "|" + candidate.getBase().getAddress().getInetAddress()
                    + " p:" + candidate.getPriority();
            if (first.equals(""))
                first = temp;
            assertEquals(first, temp);
View Full Code Here

Examples of de.javawi.jstun.test.demo.ice.ICENegociator

            // Negotiation with a STUN server for a set of interfaces is quite slow, but the results
            // never change over then instance of a JVM.  To increase connection performance considerably
            // we now cache established/initialized negotiators for each STUN server, so that subsequent uses
            // of the STUN server are much, much faster.
            if (negociatorsMap.get(server) == null) {
              ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
              negociatorsMap.put(server, iceNegociator);
             
              // gather candidates
              iceNegociator.gatherCandidateAddresses();
              // priorize candidates
              iceNegociator.prioritizeCandidates();
            }

        }
        this.setInitialized();
    }
View Full Code Here

Examples of de.javawi.jstun.test.demo.ice.ICENegociator

        }

        this.clear();

        // Create a transport candidate for each ICE negotiator candidate we have.
        ICENegociator iceNegociator = negociatorsMap.get(server);
        for (Candidate candidate : iceNegociator.getSortedCandidates())
            try {
                Candidate.CandidateType type = candidate.getCandidateType();
                ICECandidate.Type iceType = ICECandidate.Type.local;
                if (type.equals(Candidate.CandidateType.ServerReflexive))
                    iceType = ICECandidate.Type.srflx;
View Full Code Here

Examples of de.javawi.jstun.test.demo.ice.ICENegociator

            // Negotiation with a STUN server for a set of interfaces is quite slow, but the results
            // never change over then instance of a JVM.  To increase connection performance considerably
            // we now cache established/initialized negotiators for each STUN server, so that subsequent uses
            // of the STUN server are much, much faster.
            if (negociatorsMap.get(server) == null) {
              ICENegociator iceNegociator = new ICENegociator(server, port, (short) 1);
              negociatorsMap.put(server, iceNegociator);
             
              // gather candidates
              iceNegociator.gatherCandidateAddresses();
              // priorize candidates
              iceNegociator.prioritizeCandidates();
            }

        }
        this.setInitialized();
    }
View Full Code Here

Examples of de.javawi.jstun.test.demo.ice.ICENegociator

        }

        this.clear();

        // Create a transport candidate for each ICE negotiator candidate we have.
        ICENegociator iceNegociator = negociatorsMap.get(server);
        for (Candidate candidate : iceNegociator.getSortedCandidates())
            try {
                Candidate.CandidateType type = candidate.getCandidateType();
                ICECandidate.Type iceType = ICECandidate.Type.local;
                if (type.equals(Candidate.CandidateType.ServerReflexive))
                    iceType = ICECandidate.Type.srflx;
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.