()
| 60 | } |
| 61 | |
| 62 | public JabberStream openJabberStream() throws java.io.IOException { |
| 63 | String proxy = null; |
| 64 | String host = JID.getServer(); |
| 65 | int tempPort = port; |
| 66 | boolean resolveHostname = true; |
| 67 | if (hostAddr != null && hostAddr.length() > 0) { |
| 68 | host = hostAddr; |
| 69 | resolveHostname = false; |
| 70 | } |
| 71 | if (proxyHostAddr == null || proxyHostAddr.isEmpty()) { |
| 72 | proxyHostAddr = System.getProperty("http.proxyHost"); |
| 73 | proxyPort = Integer.getInteger("http.proxyPort", 1081); |
| 74 | } |
| 75 | if (resolveHostname) { |
| 76 | DnsSrvResolver dns = new DnsSrvResolver(); |
| 77 | if (dns.getSrv(JID.getServer())) { |
| 78 | host = dns.getHost(); |
| 79 | tempPort = dns.getPort(); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | if (isEnableProxy()) { |
| 84 | proxy = proxyHostAddr; |
| 85 | } |
| 86 | return new JabberStream(JID.getServer(), host, tempPort, proxy, proxyPort); |
| 87 | } |
| 88 | public boolean isEnableProxy() { |
| 89 | return enableProxy; |
| 90 | } |
no test coverage detected