/** * Set the host to connect to by either its fully qualified domain name (FQDN) or its IP. * * @param fqdnOrIp a CharSequence either representing the FQDN or the IP of the host. * @return a reference to this builder. * @see #setHost(DnsName) * @see #setHostAddress(InetAddress) * @since 4.3.2 */ public B setHostAddressByNameOrIp(CharSequence fqdnOrIp) { String fqdnOrIpString = fqdnOrIp.toString(); if (InetAddressUtil.isIpAddress(fqdnOrIp)) { InetAddress hostInetAddress; try { hostInetAddress = InetAddress.getByName(fqdnOrIpString); } catch (UnknownHostException e) { // Should never happen. throw new AssertionError(e); } setHostAddress(hostInetAddress); } else { setHost(fqdnOrIpString); } return getThis(); }
/** * Set the name of the host providing the XMPP service. Note that this method does only allow DNS names and not * IP addresses. Use {@link #setHostAddress(InetAddress)} if you want to explicitly set the Internet address of * the host providing the XMPP service. * * @param host the DNS name of the host providing the XMPP service. * @return a reference to this builder. */ public B setHost(String host) { DnsName hostDnsName = DnsName.from(host); return setHost(hostDnsName); }
/** * Set the name of the host providing the XMPP service. Note that this method does only allow DNS names and not * IP addresses. Use {@link #setHostAddress(InetAddress)} if you want to explicitly set the Internet address of * the host providing the XMPP service. * * @param host the DNS name of the host providing the XMPP service. * @return a reference to this builder. */ public B setHost(String host) { DnsName hostDnsName = DnsName.from(host); return setHost(hostDnsName); }