Android HttpHost - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android HttpHost class.

This code example shows how to use the following methods: getHostName, getPort, toHostString
            HttpHost host = (HttpHost) context.getAttribute(key);
            if (host == null) {
                throw new AuthenticationException("Authentication host is not set " + "in the execution context");
            } 
            String authServer;
            if (!this.stripPort && host.getPort() > 0) {
                authServer = host.toHostString();
            } else { 
                authServer = host.getHostName();
            } 
 
            if (LOGGER.isDebugEnabled()) { 
                LOGGER.debug("init " + authServer);
            } 
            final Oid negotiationOid = new Oid(SPNEGO_OID);
 
            final GSSManager manager = GSSManager.getInstance();
            final GSSName serverName = manager.createName("HTTP@" + authServer, GSSName.NT_HOSTBASED_SERVICE);
            final GSSContext gssContext = manager.createContext(serverName.canonicalize(negotiationOid), negotiationOid, null,
                    DEFAULT_LIFETIME);
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
            int proxyPort = Proxy.getPort(context);
            if (proxyPort == -1) {
                proxyPort = Proxy.getDefaultPort();
            } 
            if (proxyHost != null && proxyPort > -1) {
                HttpHost proxy = new HttpHost(proxyHost, proxyPort);
                httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
            } else { 
                httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null);
            } 
        } else { 
            httpParams.setParameter(ConnRoutePNames.DEFAULT_PROXY, null);
        } 
    } 
 
    public IgnitedHttpRequest get(String url) {
        return get(url, false);
    } 
 
    public IgnitedHttpRequest get(String url, boolean cached) {
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getHostName, getPort, getSchemeName
        assertEquals(100, conn.getSocketTimeout());
    } 
 
    @Test 
    public void testHttpCreateEntry() throws Exception { 
        host = new HttpHost("localhost", serverPort, "http");
        conn = connFactory.create(host);
 
        final BasicPoolEntry entry = pool.createEntry(host, conn);
 
        assertEquals(conn, entry.getConnection());
        assertEquals("localhost", entry.getRoute().getHostName());
 
        entry.close();
    } 
 
} 

7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        try { 
            client = AndroidHttpClient.newInstance("Android");
            HttpUriRequest req = new HttpGet(url);
 
            if (isProxySet) {
                HttpHost proxy = new HttpHost(proxyHost, proxyPort);
                ConnRouteParams.setDefaultProxy(req.getParams(), proxy);
            } 
 
            req.addHeader(
                    "Accept", 
                    "*/*, application/vnd.wap.mms-message, application/vnd.wap.sic"); 
 
            req.addHeader(
                    "x-wap-profile", 
                    "http://www.openmobilealliance.org/tech/profiles/UAPROF/ccppschema-20021212#"); 
 
            HttpResponse response = client.execute(req);
            StatusLine status = response.getStatusLine();
            if (status.getStatusCode() != 200) { // HTTP 200 is success.
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
 
		if (proxyHost != null && proxyPort != null) {
 
			LOG.debug("Setting proxy '{}:{}'", proxyHost, proxyPort);
 
			proxy = new HttpHost(proxyHost, Integer.parseInt(proxyPort), "http");
 
			setProxy(proxy);
		} 
	} 
 
	public void setProxy(HttpHost proxy) {
		getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
	} 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android HttpHost Questions & Answers:

See Code Examples for Android HttpHost Methods: