/** * Check a binding with the STUN currentServer. * * Note: this function blocks for some time, waiting for a response. * * @return true if the currentServer is usable. */ public boolean checkBinding() { boolean result = false; try { BindingLifetimeTest binding = new BindingLifetimeTest(hostname, port); binding.test(); while (true) { Thread.sleep(5000); if (binding.getLifetime() != -1) { if (binding.isCompleted()) { return true; } } else { break; } } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception in checkBinding", e); } return result; } }
candPort = -1; DiscoveryTest test = new DiscoveryTest(iaddress, currentServer.getHostname(), currentServer.getPort()); DiscoveryInfo di = test.test(); candAddress = di.getPublicIP() != null ? di.getPublicIP().getHostAddress() : null;
public DiscoveryInfo test() throws UtilityException, SocketException, UnknownHostException, IOException, MessageAttributeParsingException, MessageAttributeException, MessageHeaderParsingException{ ma = null; ca = null; nodeNatted = true; socketTest1 = null; di = new DiscoveryInfo(sourceIaddress); if (test1()) { if (test2()) { if (test1Redo()) { test3(); } } } socketTest1.close(); return di; }
nodeNatted = true; socketTest1 = null; di = new DiscoveryInfo(sourceIaddress); Test1Thread t1t = new Test1Thread(this); t1t.start(); Test2Thread t2t = new Test2Thread(this); t2t.start(); while (t1t.isAlive() || t2t.isAlive()) { try { Thread.currentThread().sleep(100); boolean returnTest1 = t1t.getReturnTest1(); returnTest2 = test2(); di.setOpenAccess(); di.setFullCone(); di.setSymmetricUDPFirewall(); Test1RedoThread t1rt = new Test1RedoThread(this); t1rt.start(); Test3Thread t3t = new Test3Thread(this); t3t.start();
try { Candidate local = new Candidate(new Address(iaddress.getAddress()), componentId); candidates.add(local); DiscoveryTest test = new DiscoveryTest(iaddress, 0, stunServer, stunPort); DiscoveryInfo di = test.test(); if (di.getPublicIP() != null) { Candidate cand = new Candidate(new Address(di.getPublicIP().getAddress()), CandidateType.ServerReflexive, componentId, local); cand.setComponentId(componentId); candidates.add(cand);
public void run() { try { DiscoveryTest test = new DiscoveryTest(iaddress, port, "jstun.javawi.de", 3478); //DiscoveryTest test = new DiscoveryTest(iaddress, "stun.sipgate.net", 10000); // iphone-stun.freenet.de:3478 // larry.gloo.net:3478 // stun.xten.net:3478 // stun.sipgate.net:10000 System.out.println(test.test()); } catch (BindException be) { System.out.println(iaddress.toString() + ": " + be.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
public void test() throws UtilityException, SocketException, UnknownHostException, IOException, MessageAttributeParsingException, MessageAttributeException, MessageHeaderParsingException { initialSocket = new DatagramSocket(); initialSocket.connect(InetAddress.getByName(stunServer), port); initialSocket.setSoTimeout(timeout); if (bindingCommunicationInitialSocket()) { return; } BindingLifetimeTask task = new BindingLifetimeTask(); timer.schedule(task, binarySearchLifetime); LOGGER.debug("Timer scheduled initially: " + binarySearchLifetime + "."); }
public void run() { try { FastDiscoveryTest test = new FastDiscoveryTest(iaddress, port, "jstun.javawi.de", 3478); //DiscoveryTest test = new DiscoveryTest(iaddress, "stun.sipgate.net", 10000); // iphone-stun.freenet.de:3478 // larry.gloo.net:3478 // stun.xten.net:3478 // stun.sipgate.net:10000 System.out.println(test.test()); } catch (BindException be) { System.out.println(iaddress.toString() + ": " + be.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
public void run() { try { lifetimeQuery(); } catch (Exception e) { LOGGER.debug("Unhandled Exception. BindLifetimeTasks stopped."); e.printStackTrace(); } }
/** * Check a binding with the STUN currentServer. * <p/> * Note: this function blocks for some time, waiting for a response. * * @return true if the currentServer is usable. */ public boolean checkBinding() { boolean result = false; try { BindingLifetimeTest binding = new BindingLifetimeTest(hostname, port); binding.test(); while (true) { Thread.sleep(5000); if (binding.getLifetime() != -1) { if (binding.isCompleted()) { return true; } } else { break; } } } catch (Exception e) { LOGGER.log(Level.SEVERE, "Exception in checkBinding", e); } return result; } }
nodeNatted = true; socketTest1 = null; di = new DiscoveryInfo(sourceIaddress); Test1Thread t1t = new Test1Thread(this); t1t.start(); Test2Thread t2t = new Test2Thread(this); t2t.start(); while (t1t.isAlive() || t2t.isAlive()) { try { Thread.currentThread().sleep(100); boolean returnTest1 = t1t.getReturnTest1(); returnTest2 = test2(); di.setOpenAccess(); di.setFullCone(); di.setSymmetricUDPFirewall(); Test1RedoThread t1rt = new Test1RedoThread(this); t1rt.start(); Test3Thread t3t = new Test3Thread(this); t3t.start();
try { Candidate local = new Candidate(new Address(iaddress.getAddress()), componentId); candidates.add(local); DiscoveryTest test = new DiscoveryTest(iaddress, 0, stunServer, stunPort); DiscoveryInfo di = test.test(); if (di.getPublicIP() != null) { Candidate cand = new Candidate(new Address(di.getPublicIP().getAddress()), CandidateType.ServerReflexive, componentId, local); cand.setComponentId(componentId); candidates.add(cand);
candPort = -1; DiscoveryTest test = new DiscoveryTest(iaddress, currentServer.getHostname(), currentServer.getPort()); DiscoveryInfo di = test.test(); candAddress = di.getPublicIP() != null ? di.getPublicIP().getHostAddress() : null;
public void run() { try { DiscoveryTest test = new DiscoveryTest(iaddress, port, "jstun.javawi.de", 3478); //DiscoveryTest test = new DiscoveryTest(iaddress, "stun.sipgate.net", 10000); // iphone-stun.freenet.de:3478 // larry.gloo.net:3478 // stun.xten.net:3478 // stun.sipgate.net:10000 System.out.println(test.test()); } catch (BindException be) { System.out.println(iaddress.toString() + ": " + be.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
public DiscoveryInfo test() throws UtilityException, SocketException, UnknownHostException, IOException, MessageAttributeParsingException, MessageAttributeException, MessageHeaderParsingException{ ma = null; ca = null; nodeNatted = true; socketTest1 = null; di = new DiscoveryInfo(sourceIaddress); if (test1()) { if (test2()) { if (test1Redo()) { test3(); } } } socketTest1.close(); return di; }
public void test() throws UtilityException, SocketException, UnknownHostException, IOException, MessageAttributeParsingException, MessageAttributeException, MessageHeaderParsingException { initialSocket = new DatagramSocket(); initialSocket.connect(InetAddress.getByName(stunServer), port); initialSocket.setSoTimeout(timeout); if (bindingCommunicationInitialSocket()) { return; } BindingLifetimeTask task = new BindingLifetimeTask(); timer.schedule(task, binarySearchLifetime); LOGGER.debug("Timer scheduled initially: " + binarySearchLifetime + "."); }
public void run() { try { FastDiscoveryTest test = new FastDiscoveryTest(iaddress, port, "jstun.javawi.de", 3478); //DiscoveryTest test = new DiscoveryTest(iaddress, "stun.sipgate.net", 10000); // iphone-stun.freenet.de:3478 // larry.gloo.net:3478 // stun.xten.net:3478 // stun.sipgate.net:10000 System.out.println(test.test()); } catch (BindException be) { System.out.println(iaddress.toString() + ": " + be.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } }
public void run() { try { lifetimeQuery(); } catch (Exception e) { LOGGER.debug("Unhandled Exception. BindLifetimeTasks stopped."); e.printStackTrace(); } }
/** * Check a binding with the STUN currentServer. * <p/> * Note: this function blocks for some time, waiting for a response. * * @return true if the currentServer is usable. */ public boolean checkBinding() { boolean result = false; try { BindingLifetimeTest binding = new BindingLifetimeTest(hostname, port); binding.test(); while (true) { Thread.sleep(5000); if (binding.getLifetime() != -1) { if (binding.isCompleted()) { return true; } } else { break; } } } catch (Exception e) { LOGGER.error(e.getMessage(), e); } return result; } }
public static void main(String args[]) { try { Handler fh = new FileHandler("logging.txt"); fh.setFormatter(new SimpleFormatter()); java.util.logging.Logger.getLogger("de.javawi.stun").addHandler(fh); java.util.logging.Logger.getLogger("de.javawi.stun").setLevel(Level.ALL); BindingLifetimeTest test = new BindingLifetimeTest("jstun.javawi.de", 3478); // iphone-stun.freenet.de:3478 // larry.gloo.net:3478 // stun.xten.net:3478 test.test(); boolean continueWhile = true; while(continueWhile) { Thread.sleep(5000); if (test.getLifetime() != -1) { System.out.println("Lifetime: " + test.getLifetime() + " Finished: " + test.isCompleted()); if (test.isCompleted()) continueWhile = false; } } } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }