org.jivesoftware.smack.proxy.ProxyInfo Java Examples
The following examples show how to use
org.jivesoftware.smack.proxy.ProxyInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 6 votes |
private void init(String host, int port, String serviceName, ProxyInfo proxy) { this.host = host; this.port = port; this.serviceName = serviceName; this.proxy = proxy; // Build the default path to the cacert truststore file. By default we are // going to use the file located in $JREHOME/lib/security/cacerts. String javaHome = System.getProperty("java.home"); StringBuilder buffer = new StringBuilder(); buffer.append(javaHome).append(File.separator).append("lib"); buffer.append(File.separator).append("security"); buffer.append(File.separator).append("cacerts"); truststorePath = buffer.toString(); // Set the default store type truststoreType = "jks"; // Set the default password of the cacert file that is "changeit" truststorePassword = "changeit"; keystorePath = System.getProperty("javax.net.ssl.keyStore"); keystoreType = "jks"; pkcs11Library = "pkcs11.config"; //Setting the SocketFactory according to proxy supplied socketFactory = proxy.getSocketFactory(); }
Example #2
Source File: BOSHConfiguration.java From Smack with Apache License 2.0 | 6 votes |
private BOSHConfiguration(Builder builder) { super(builder); if (proxy != null) { if (proxy.getProxyType() != ProxyInfo.ProxyType.HTTP) { throw new IllegalArgumentException( "Only HTTP proxies are support with BOSH connections"); } } https = builder.https; if (builder.file.charAt(0) != '/') { file = '/' + builder.file; } else { file = builder.file; } httpHeaders = builder.httpHeaders; }
Example #3
Source File: BOSHConfiguration.java From AndroidPNClient with Apache License 2.0 | 4 votes |
public boolean isProxyEnabled() { return (proxy != null && proxy.getProxyType() != ProxyInfo.ProxyType.NONE); }
Example #4
Source File: BOSHConfiguration.java From AndroidPNClient with Apache License 2.0 | 4 votes |
public ProxyInfo getProxyInfo() { return proxy; }
Example #5
Source File: BOSHConfiguration.java From Smack with Apache License 2.0 | 4 votes |
@Override public ProxyInfo getProxyInfo() { return proxy; }
Example #6
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 3 votes |
/** * Creates a new ConnectionConfiguration for the specified service name. * A DNS SRV lookup will be performed to find out the actual host address * and port to use for the connection. * * @param serviceName the name of the service provided by an XMPP server. */ public ConnectionConfiguration(String serviceName) { // Perform DNS lookup to get host and port to use DNSUtil.HostAddress address = DNSUtil.resolveXMPPDomain(serviceName); init(address.getHost(), address.getPort(), serviceName, ProxyInfo.forDefaultProxy()); }
Example #7
Source File: BOSHConfiguration.java From AndroidPNClient with Apache License 2.0 | 3 votes |
/** * Create a HTTP Binding configuration. * * @param https true if you want to use SSL * (e.g. false for http://domain.lt:7070/http-bind). * @param host the hostname or IP address of the connection manager * (e.g. domain.lt for http://domain.lt:7070/http-bind). * @param port the port of the connection manager * (e.g. 7070 for http://domain.lt:7070/http-bind). * @param filePath the file which is described by the URL * (e.g. /http-bind for http://domain.lt:7070/http-bind). * @param proxy the configuration of a proxy server. * @param xmppDomain the XMPP service name * (e.g. domain.lt for the user [email protected]) */ public BOSHConfiguration(boolean https, String host, int port, String filePath, ProxyInfo proxy, String xmppDomain) { super(host, port, xmppDomain, proxy); setSASLAuthenticationEnabled(true); ssl = https; file = (filePath != null ? filePath : "/"); }
Example #8
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 2 votes |
/** * Creates a new ConnectionConfiguration for the specified service name * with specified proxy. * A DNS SRV lookup will be performed to find out the actual host address * and port to use for the connection. * * @param serviceName the name of the service provided by an XMPP server. * @param proxy the proxy through which XMPP is to be connected */ public ConnectionConfiguration(String serviceName,ProxyInfo proxy) { // Perform DNS lookup to get host and port to use DNSUtil.HostAddress address = DNSUtil.resolveXMPPDomain(serviceName); init(address.getHost(), address.getPort(), serviceName, proxy); }
Example #9
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 2 votes |
/** * Creates a new ConnectionConfiguration using the specified host, port and * service name. This is useful for manually overriding the DNS SRV lookup * process that's used with the {@link #ConnectionConfiguration(String)} * constructor. For example, say that an XMPP server is running at localhost * in an internal network on port 5222 but is configured to think that it's * "example.com" for testing purposes. This constructor is necessary to connect * to the server in that case since a DNS SRV lookup for example.com would not * point to the local testing server. * * @param host the host where the XMPP server is running. * @param port the port where the XMPP is listening. * @param serviceName the name of the service provided by an XMPP server. */ public ConnectionConfiguration(String host, int port, String serviceName) { init(host, port, serviceName, ProxyInfo.forDefaultProxy()); }
Example #10
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 2 votes |
/** * Creates a new ConnectionConfiguration using the specified host, port and * service name. This is useful for manually overriding the DNS SRV lookup * process that's used with the {@link #ConnectionConfiguration(String)} * constructor. For example, say that an XMPP server is running at localhost * in an internal network on port 5222 but is configured to think that it's * "example.com" for testing purposes. This constructor is necessary to connect * to the server in that case since a DNS SRV lookup for example.com would not * point to the local testing server. * * @param host the host where the XMPP server is running. * @param port the port where the XMPP is listening. * @param serviceName the name of the service provided by an XMPP server. * @param proxy the proxy through which XMPP is to be connected */ public ConnectionConfiguration(String host, int port, String serviceName, ProxyInfo proxy) { init(host, port, serviceName, proxy); }
Example #11
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 2 votes |
/** * Creates a new ConnectionConfiguration for a connection that will connect * to the desired host and port. * * @param host the host where the XMPP server is running. * @param port the port where the XMPP is listening. */ public ConnectionConfiguration(String host, int port) { init(host, port, host, ProxyInfo.forDefaultProxy()); }
Example #12
Source File: ConnectionConfiguration.java From AndroidPNClient with Apache License 2.0 | 2 votes |
/** * Creates a new ConnectionConfiguration for a connection that will connect * to the desired host and port with desired proxy. * * @param host the host where the XMPP server is running. * @param port the port where the XMPP is listening. * @param proxy the proxy through which XMPP is to be connected */ public ConnectionConfiguration(String host, int port, ProxyInfo proxy) { init(host, port, host, proxy); }
Example #13
Source File: ConnectionConfiguration.java From Smack with Apache License 2.0 | 2 votes |
/** * Get the configured proxy information (if any). * * @return the configured proxy information or <code>null</code>. */ public ProxyInfo getProxyInfo() { return proxy; }
Example #14
Source File: ConnectionConfiguration.java From Smack with Apache License 2.0 | 2 votes |
/** * Set the information about the Proxy used for the connection. * * @param proxyInfo the Proxy information. * @return a reference to this builder. */ public B setProxyInfo(ProxyInfo proxyInfo) { this.proxy = proxyInfo; return getThis(); }