@Test public void testSocketServerConnection_PropertiesClientHost() throws Throwable { Properties p = new Properties(); SocketServerConnection.updateConnectionProperties(p, InetAddress.getLocalHost(), true, null); assertTrue(p.containsKey(TeiidURL.CONNECTION.CLIENT_HOSTNAME)); assertTrue(p.containsKey(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS)); }
public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver) { if (addr == null) { return; } String address = addr.getHostAddress(); Object old = connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, address); if (old == null || !address.equals(old)) { String hostname = null; if (resolver != null) { hostname = resolver.resolveHostname(addr); } if (hostname == null) { hostname = "unknown"; } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, hostname); if (setMac) { try { NetworkInterface ni = NetworkInterface.getByInetAddress(addr); if (ni != null && ni.getHardwareAddress() != null) { StringBuilder sb = new StringBuilder(); for (byte b : ni.getHardwareAddress()) { sb.append(PropertiesUtils.toHex(b >> 4)); sb.append(PropertiesUtils.toHex(b)); } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString()); } } catch (SocketException e) { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } else { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } }
SocketServerConnection implements ServerConnection { public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver) { if (addr == null) { return; } String address = addr.getHostAddress(); Object old = connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, address); if (old == null || !address.equals(old)) { String hostname = null; if (resolver != null) { hostname = resolver.resolveHostname(addr); } if (hostname == null) { hostname = "unknown"; } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, hostname); if (setMac) { try { NetworkInterface ni = NetworkInterface.getByInetAddress(addr); if (ni != null && ni.getHardwareAddress() != null) { StringBuilder sb = new StringBuilder(); for (byte b : ni.getHardwareAddress()) { sb.append(PropertiesUtils.toHex(b >> 4)); sb.append(PropertiesUtils.toHex(b)); } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString()); } } catch (SocketException e) { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } else { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } } }
SocketServerConnection implements ServerConnection { public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver) { if (addr == null) { return; } String address = addr.getHostAddress(); Object old = connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, address); if (old == null || !address.equals(old)) { String hostname = null; if (resolver != null) { hostname = resolver.resolveHostname(addr); } if (hostname == null) { hostname = "unknown"; } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, hostname); if (setMac) { try { NetworkInterface ni = NetworkInterface.getByInetAddress(addr); if (ni != null && ni.getHardwareAddress() != null) { StringBuilder sb = new StringBuilder(); for (byte b : ni.getHardwareAddress()) { sb.append(PropertiesUtils.toHex(b >> 4)); sb.append(PropertiesUtils.toHex(b)); } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString()); } } catch (SocketException e) { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } else { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } } SocketServerConnection(
            SocketServerInstanceFactory connectionFactory, boolean secure,
            UrlServerDiscovery serverDiscovery, Properties connProps); }
SocketServerConnection implements ServerConnection { public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver) { if (addr == null) { return; } String address = addr.getHostAddress(); Object old = connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, address); if (old == null || !address.equals(old)) { String hostname = null; if (resolver != null) { hostname = resolver.resolveHostname(addr); } if (hostname == null) { hostname = "unknown"; } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, hostname); if (setMac) { try { NetworkInterface ni = NetworkInterface.getByInetAddress(addr); if (ni != null && ni.getHardwareAddress() != null) { StringBuilder sb = new StringBuilder(); for (byte b : ni.getHardwareAddress()) { sb.append(PropertiesUtils.toHex(b >> 4)); sb.append(PropertiesUtils.toHex(b)); } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString()); } } catch (SocketException e) { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } else { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } } SocketServerConnection(
            SocketServerInstanceFactory connectionFactory, boolean secure,
            UrlServerDiscovery serverDiscovery, Properties connProps); synchronized SocketServerInstance selectServerInstance(); static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver); T getService(Class<T> iface); synchronized void close(); boolean isOpen(long msToTest); LogonResult getLogonResult(); boolean isSameInstance(ServerConnection otherService); void setFailOver(boolean failOver); void setFailOverPingInterval(int pingFailOverInterval); @Override void authenticate(); @Override boolean supportsContinuous(); @Override boolean isLocal(); @Override String getServerVersion(); }
SocketServerConnection implements ServerConnection { public static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver) { if (addr == null) { return; } String address = addr.getHostAddress(); Object old = connectionProperties.put(TeiidURL.CONNECTION.CLIENT_IP_ADDRESS, address); if (old == null || !address.equals(old)) { String hostname = null; if (resolver != null) { hostname = resolver.resolveHostname(addr); } if (hostname == null) { hostname = "unknown"; } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_HOSTNAME, hostname); if (setMac) { try { NetworkInterface ni = NetworkInterface.getByInetAddress(addr); if (ni != null && ni.getHardwareAddress() != null) { StringBuilder sb = new StringBuilder(); for (byte b : ni.getHardwareAddress()) { sb.append(PropertiesUtils.toHex(b >> 4)); sb.append(PropertiesUtils.toHex(b)); } connectionProperties.put(TeiidURL.CONNECTION.CLIENT_MAC, sb.toString()); } } catch (SocketException e) { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } else { connectionProperties.remove(TeiidURL.CONNECTION.CLIENT_MAC); } } } SocketServerConnection(
            SocketServerInstanceFactory connectionFactory, boolean secure,
            UrlServerDiscovery serverDiscovery, Properties connProps); synchronized SocketServerInstance selectServerInstance(); static void updateConnectionProperties(Properties connectionProperties, InetAddress addr, boolean setMac, HostnameResolver resolver); T getService(Class<T> iface); synchronized void close(); boolean isOpen(long msToTest); LogonResult getLogonResult(); boolean isSameInstance(ServerConnection otherService); void setFailOver(boolean failOver); void setFailOverPingInterval(int pingFailOverInterval); @Override void authenticate(); @Override boolean supportsContinuous(); @Override boolean isLocal(); @Override String getServerVersion();  }