Returns either the {@link InetSocketAddress} provided to the constructor or a new instance for every invocation based on the {@link String} provided to the constructor.

@return An instance of {@link InetSocketAddress}.
339740
public InetSocketAddress getEndpoint() {
        return endpoint == null ? new InetSocketAddress(uri.getHost(), uri.getPort()) : endpoint;
    }
578408
public static InetSocketAddress replaceWithResolved(
			InetSocketAddress inetSocketAddress) {
		if (!inetSocketAddress.isUnresolved()) {
			return inetSocketAddress;
		}
		inetSocketAddress = replaceUnresolvedNumericIp(inetSocketAddress);
		if (!inetSocketAddress.isUnresolved()) {
			return inetSocketAddress;
		}
		else {
			return new InetSocketAddress(inetSocketAddress.getHostString(),
					inetSocketAddress.getPort());
		}
	}
1362577
public String getHostAddress() {
        if( addr instanceof NbtAddress ) {
            return ((NbtAddress)addr).getHostAddress();
        }
        return ((InetAddress)addr).getHostAddress();
    }
329588
public static InetAddress getLocalHost() {

        if (localHost == null) {
            try {
                localHost = java.net.InetAddress.getLocalHost();
            } catch (UnknownHostException e) {
                LOGGER.error("Cannot get local host address. exception is: " + e);
                localHost = null;
                hostName = "UNKNOWN";
                ipAddress = "UNKNOWN";
            }
        }

        return localHost;

    }
476179
protected final InetSocketAddress remoteAddress() {
        if (remoteAddress == null) {
            if (server) {
                remoteAddress = new InetSocketAddress(NetUtil.LOCALHOST, randomClientPort());
            } else {
                remoteAddress = new InetSocketAddress(NetUtil.LOCALHOST,
                                                      guessServerPort(sessionProtocol, authority));
            }
        }
        return remoteAddress;
    }
727751
@Nullable
  public static InetSocketAddress parseInetSocketAddress(String address) throws IOException {
    if (address == null) {
      return null;
    }
    String[] strArr = address.split(":");
    if (strArr.length != 2) {
      throw new IOException("Invalid InetSocketAddress " + address);
    }
    return new InetSocketAddress(strArr[0], Integer.parseInt(strArr[1]));
  }
427580
public static InetAddress getLocalAddress() {
        InetAddress localAddress = null;
        try {
            localAddress = InetAddress.getLocalHost();
            if (isValidAddress(localAddress)) {
                return localAddress;
            }
        } catch (Throwable e) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
            }
        }
        try {
            Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
            if (interfaces != null) {
                while (interfaces.hasMoreElements()) {
                    try {
                        NetworkInterface network = interfaces.nextElement();
                        Enumeration<InetAddress> addresses = network.getInetAddresses();
                        while (addresses.hasMoreElements()) {
                            try {
                                InetAddress address = addresses.nextElement();
                                if (isValidAddress(address)) {
                                    return address;
                                }
                            } catch (Throwable e) {
                                if (LOGGER.isWarnEnabled()) {
                                    LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
                                }
                            }
                        }
                    } catch (Throwable e) {
                        if (LOGGER.isWarnEnabled()) {
                            LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
                        }
                    }
                }
            }
        } catch (Throwable e) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Error when retrieving ip address: " + e.getMessage(), e);
            }
        }
        if (LOGGER.isErrorEnabled()) {
            LOGGER.error("Can't get valid host, will use 127.0.0.1 instead.");
        }
        return localAddress;
    }
1368107
@Override
	public Inet6Address toInetAddress() {
		if(hasZone()) {
			Inet6Address result;
			if(hasNoValueCache() || (result = valueCache.inetAddress) == null) {
				valueCache.inetAddress = result = (Inet6Address) toInetAddressImpl(getBytes());
			}
			return result;
		}
		return (Inet6Address) super.toInetAddress();
	}
1025947
public SockAddr getAddr() {
		SockAddr sockAddr = null;
		if (this.addr != null) {
			sockAddr = new SockAddr(this.addr.getSaFamily().getValue(), this.addr.getData());
		}
		return sockAddr;
	}
814852
public InetAddress getRemoteAddress() {
        final Channel channel;
        try {
            channel = strategy.getChannel();
        } catch (IOException e) {
            return null;
        }
        final Connection connection = channel.getConnection();
        final InetSocketAddress peerAddress = connection.getPeerAddress(InetSocketAddress.class);
        return peerAddress == null ? null : peerAddress.getAddress();
    }
861405
public static InetAddress getLocalAddress() throws UnknownHostException, SocketException {
        InetAddress addr = InetAddress.getLocalHost();
        NetworkInterface nif = NetworkInterface.getByInetAddress(addr);
        if (addr.isLoopbackAddress() || addr instanceof Inet6Address || nif == null) {
            // Find local address that isn't a loopback address
            InetAddress lookedUpAddr = findLocalAddressViaNetworkInterface();
            // If a local, multicast enabled address can be found, use it. Otherwise
            // we are using the local address, which might not be what you want
            addr = lookedUpAddr != null ? lookedUpAddr : InetAddress.getByName("127.0.0.1");
        }
        return addr;
    }
833257
public static String formatAddress(InetSocketAddress inet){
        if(inet == null){
            throw new NullPointerException();
        }
        StringBuilder result = new StringBuilder();
        if(inet.isUnresolved()){
            result.append(inet.getHostName());
        }else{
            result.append(formatPossibleIpv6Address(formatAddress(inet.getAddress())));
        }
        result.append(":").append(inet.getPort());
        return result.toString();
    }
851733
public Map<InetSocketAddress, ServerPort> activePorts() {
        final Server server = this.server;
        if (server != null) {
            return server.activePorts();
        } else {
            return Collections.emptyMap();
        }
    }
355932
public InetSocketAddress getMulticastSocketAddress() {
        if (multicastAddress == null) {
            throw MESSAGES.noMulticastBinding(name);
        }
        return new InetSocketAddress(multicastAddress, multicastPort);
    }
133646
public InetAddress
getAddress() {
	try {
		if (name == null)
			return InetAddress.getByAddress(address);
		else
			return InetAddress.getByAddress(name.toString(),
							address);
	} catch (UnknownHostException e) {
		return null;
	}
}
70314
public static InetAddress getLoopbackAddress() {
		try {
			final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
			if (interfaces != null) {
				NetworkInterface inter;
				InetAddress adr;
				Enumeration<InetAddress> addrs;
				while (interfaces.hasMoreElements()) {
					inter = interfaces.nextElement();
					addrs = inter.getInetAddresses();
					if (addrs != null) {
						while (addrs.hasMoreElements()) {
							adr = addrs.nextElement();
							if (adr != null && adr.isLoopbackAddress() && (adr instanceof Inet4Address)) {
								return adr;
							}
						}
					}
				}
			}
		} catch (SocketException e) {
			//
		}
		return null;
	}
726472
@Override
  public InetAddress addressRemote()
  {
    SocketChannel s = _channel;
    
    if (s != null) {
      try {
        InetSocketAddress addr = (InetSocketAddress) s.getRemoteAddress();
        
        return addr.getAddress();
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
    }
    else {
      return null;
    }
  }