This method MUST retain the state of the current instance, and return
an instance that contains the specified host.
548123
function it_retains_the_original_state_of_the_instance_duplicated_with_a_new_host()
    {
        $original_uri = (string) $this->getWrappedObject();

        $new_host = $this->withHost("quux.qux");

        $this->__toString()->shouldReturn($original_uri);
    }
216481
def get(self, hostport):
        
        assert hostport, "hostport is required"
        assert isinstance(hostport, basestring), "hostport must be a string"

        if hostport not in self._peers:
            self._add(hostport)

        return self._peers[hostport]
188228
def host=(new_host)
      if new_host && !new_host.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_host.class} into String."
      end
      @host = new_host ? new_host.to_str : nil

      # Reset dependent values
      remove_instance_variable(:@authority) if defined?(@authority)
      remove_instance_variable(:@normalized_host) if defined?(@normalized_host)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
318633
private static CloseableHttpClient wrapClient(String host) {

        CloseableHttpClient httpClient = HttpClientBuilder.create().build();

        if (host.startsWith("https://")) {
            httpClient = sslClient();
        }

        return httpClient;
    }
130952
public String migrate(String host, int port, Object key, int destinationDb, int timeout) {
		Jedis jedis = getJedis();
		try {
			return jedis.migrate(valueToBytes(host), port, keyToBytes(key), destinationDb, timeout);
		}
		finally {close(jedis);}
	}
192311
def host(self, hostname=None):
        
        if (hostname is None) or (hostname == self.__hostname):
            return self.__hostname
        # when hostname change ensure old socket is close
        self.close()
        # IPv4 ?
        try:
            socket.inet_pton(socket.AF_INET, hostname)
            self.__hostname = hostname
            return self.__hostname
        except socket.error:
            pass
        # IPv6 ?
        try:
            socket.inet_pton(socket.AF_INET6, hostname)
            self.__hostname = hostname
            return self.__hostname
        except socket.error:
            pass
        # DNS name ?
        if re.match('^[a-z][a-z0-9\.\-]+$', hostname):
            self.__hostname = hostname
            return self.__hostname
        else:
            return None
486819
def for_host(parent, host):
        
        account = AccountProxy(parent)
        account.host = host
        if account.acquire():
            return account
        return None
760918
@Nullable
    public static DnsCacheEntry getDnsCache(String host) {
        try {
            return InetAddressCacheUtil.getInetAddressCache(host);
        } catch (Exception e) {
            throw new DnsCacheManipulatorException("Fail to getDnsCache, cause: " + e.toString(), e);
        }
    }
730670
function Client(host, port) {
    // Invokes with new if called without
    if (false === (this instanceof Client)) {
  	return new Client(host, port)
    }

    this.host = host;
    this.port = port;
}
960112
def get_self_host(request_data):
        
        if 'http_host' in request_data:
            current_host = request_data['http_host']
        elif 'server_name' in request_data:
            current_host = request_data['server_name']
        else:
            raise Exception('No hostname defined')

        if ':' in current_host:
            current_host_data = current_host.split(':')
            possible_port = current_host_data[-1]
            try:
                possible_port = float(possible_port)
                current_host = current_host_data[0]
            except ValueError:
                current_host = ':'.join(current_host_data)

        return current_host
1336741
public boolean isHostProxyable(String host) {
        return getProxyHost() != null
                && getProxyPort() > 0
                && (nonProxyPattern == null || !nonProxyPattern.matcher(host)
                        .matches());
    }
1266168
@Deprecated
  DatanodeDescriptor getDatanodeByHost(String host) {
    if (host==null) {
      return null;
    }
      
    hostmapLock.readLock().lock();
    try {
      DatanodeDescriptor[] nodes = map.get(host);
      // no entry
      if (nodes== null) {
        return null;
      }
      // one node
      if (nodes.length == 1) {
        return nodes[0];
      }
      // more than one node
      return nodes[r.nextInt(nodes.length)];
    } finally {
      hostmapLock.readLock().unlock();
    }
  }
257750
@Override
    @Synchronized
    public void deregisterHost(Host host) {
        Preconditions.checkNotNull(host, "host");
        PersistentNode node = entryMap.get(host);
        Preconditions.checkNotNull(node, "Host is not present in cluster.");
        entryMap.remove(host);
        close(node);
    }
232683
def with_host(self, host):
        
        # N.B. doesn't cleanup query/fragment
        if not isinstance(host, str):
            raise TypeError("Invalid host type")
        if not self.is_absolute():
            raise ValueError("host replacement is not allowed " "for relative URLs")
        if not host:
            raise ValueError("host removing is not allowed")
        host = self._encode_host(host)
        val = self._val
        return URL(
            self._val._replace(
                netloc=self._make_netloc(
                    val.username, val.password, host, val.port, encode=False
                )
            ),
            encoded=True,
        )
1291342
function (host, reInit) {
        if (_.isEmpty(host.id) || !_.isString(host.id)) {
            throw new Error("Host configuration is invalid. Host id is missing or not a string");
        }
        if (_.isEmpty(host.host)) {
            throw new Error("Host configuration is invalid. Host is missing");
        }

        if (_.isString(host.host)) {
            host.host = [host.host];
        }

        if (!_.isArray(host.host)) {
            throw new Error("Host configuration is invalid. Host should be array or string");
        }

        var router = new express.Router();

        if (reInit === false) {
            // Check if host is already defined. Use same router instance to merge routes
            for (var index in _vhosts) {
                for (var vh in _vhosts[index]["host"]) {
                    if (_vhosts[index]["host"][vh] == host.host) {
                        router = _vhosts[index]["router"];
                    }
                }
            }
        }

        _vhosts[host.id] = {
            host: host.host,
            router: router,
            http: !host.listener ? true : host.listener && host.listener.http || null,
            https: !host.listener ? true : host.listener && host.listener.https || null
        };

        _applyRouterConfig(_vhosts[host.id]["router"]);
        _customInitFuncton(_vhosts[host.id]["router"]);
    }
1262892
def host(self, hostname, owner=None, **kwargs):
        
        return Host(self.tcex, hostname, owner=owner, **kwargs)
1126681
public final B host(String host, int port) {
        requireNonNull(host, "host");
        checkArgument(!host.startsWith("group:"), "host: %s (must not start with 'group:')", host);
        checkArgument(port >= 1 && port < 65536, "port: %s (expected: 1 .. 65535)", port);

        final InetSocketAddress addr = newEndpoint(host, port);
        checkState(selectedProfile == null, "profile() and host() cannot be used together.");
        hosts = ImmutableSet.<InetSocketAddress>builder().addAll(hosts).add(addr).build();
        return self();
    }