@Test public void ip() throws UnknownHostException { Assert.assertEquals(NetworkUtils.getLocalHost().getHostAddress(), evaluate("server.ip")); }
/** * Creates the server address object with the IP and port that a server should bind to. */ private ServerAddress createServerAddress(String host, int port) throws UnknownHostException { return new DefaultServerAddress(NetworkUtils.getLocalHostIp(host), port); }
@Test public void host() throws UnknownHostException { Assert.assertEquals(NetworkUtils.getLocalHost().getCanonicalHostName(), evaluate("server.host")); }
System.getProperty("os.version"), System.getProperty("os.arch"))); try { InetAddress host = NetworkUtils.getLocalHost(); doBody(String.format("Host: %s (%s)", host.getHostName(), host.getHostAddress())); } catch (UnknownHostException e) {
public String getIp() throws UnknownHostException { return NetworkUtils.getLocalHost().getHostAddress(); }
public String getHost() throws UnknownHostException { return NetworkUtils.getLocalHost().getCanonicalHostName(); }
public Object create(Map<?, ?> props) throws Exception { // we could use getCanonicalHostName here. however, on machines behind // NAT firewalls it seems that is often the NAT address, which corresponds // to an interface on the firewall, not on the local machine. try { return NetworkUtils.getLocalHost().getHostName(); } catch (Exception e) { logger.warn("Unable to resolve hostname, defaulting to 'localhost': " + e.getMessage(), e); return "localhost"; } }
public DefaultMuleConfiguration(boolean containerMode) { this.containerMode = containerMode; // Apply any settings which come from the JVM system properties. applySystemProperties(); if (id == null) { id = UUID.getUUID(); } if (domainId == null) { try { domainId = NetworkUtils.getLocalHost().getHostName(); } catch (UnknownHostException e) { logger.warn("Unable to obtain hostname", e); domainId = "org.mule.runtime.core"; } } try { validateEncoding(); } catch (FatalException e) { throw new RuntimeException(e); } }
+ " (" + System.getProperty("os.version") + ", " + System.getProperty("os.arch") + ")"); try { InetAddress host = NetworkUtils.getLocalHost(); header.add("Host: " + host.getHostName() + " (" + host.getHostAddress() + ")"); } catch (UnknownHostException e) {
@Test public void host() throws UnknownHostException { Assert.assertEquals(NetworkUtils.getLocalHost().getCanonicalHostName(), evaluate("server.host")); }
@Test public void ip() throws UnknownHostException { Assert.assertEquals(NetworkUtils.getLocalHost().getHostAddress(), evaluate("server.ip")); }
System.getProperty("os.version"), System.getProperty("os.arch"))); try { InetAddress host = NetworkUtils.getLocalHost(); doBody(String.format("Host: %s (%s)", host.getHostName(), host.getHostAddress())); } catch (UnknownHostException e) {