SchemeRegistry register - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SchemeRegistry register method.

This code example shows how to use the following methods:register
		} 
 
		public ClientConnectionManager configureConnectionManager(
				HttpParams params) {
			if (conman == null) {
				SchemeRegistry schemeRegistry = new SchemeRegistry();
				schemeRegistry.register(configureScheme());
 
				ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);
				conman = cm;
			} 
 
			if (cleanupIdleConnections) {
				IdleConnectionMonitor.monitor(conman);
			} 
			return conman;
		} 
 
		private Scheme configureScheme() {
			if (enableSSL) {
6
CodeRank
This code example shows how to use the following methods:get, getScheme, register, unregister,
        Assert.assertNotNull(schmreg.get(name));
    } 
 
    @Test 
    public void testIllegalRegisterUnregister() { 
        SchemeRegistry schmreg = new SchemeRegistry();
        try { 
            schmreg.register(null);
            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected 
        } 
        try { 
            schmreg.unregister(null);
            Assert.fail("IllegalArgumentException should have been thrown");
        } catch (IllegalArgumentException ex) {
            // expected 
        } 
        try { 
            schmreg.get(null);

6
CodeRank
This code example shows how to use the following methods:register
		params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false);
		HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
 
		//ClientConnectionManager cm = new ThreadSafeClientConnManager(params, schemeRegistry); 
	         
	    SchemeRegistry registry = new SchemeRegistry();
	    registry.register(new Scheme("http", new PlainSocketFactory(), 80)); 
	    registry.register(new Scheme("https", (trustAll  ? EasySSLSocketFactory.getSocketFactory(): SSLSocketFactory.getSocketFactory()), 443));
	    DefaultHttpClient client = new DefaultHttpClient(new ThreadSafeClientConnManager(params, registry), params);
		 
	       return client;
	} 
	 
	public CaldavFacade(String mUser, String mPassword, String mURL) throws MalformedURLException  {
		url = new URL(mURL);
		 
		httpClient = getHttpClient();
		 
	    UsernamePasswordCredentials upc = new UsernamePasswordCredentials(mUser, mPassword);
		 
5
CodeRank
This code example shows how to use the following methods:register
 
	        HttpParams params = new BasicHttpParams();
	        HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
	        HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
 
	        SchemeRegistry registry = new SchemeRegistry();
	        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
	        registry.register(new Scheme("https", sf, 443));
 
	        ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
 
	        return new DefaultHttpClient(ccm, params);
	    }  
	     
	    catch (Exception e) {
	        return new DefaultHttpClient();
	    } 
	} 
	 
    @Override 
5
CodeRank
This code example shows how to use the following methods:register
public class Fetcher { 
	DefaultHttpClient httpclient;
	String baseURL;
 
	public Fetcher(String baseURL) {
	    SchemeRegistry registry = new SchemeRegistry();
	    registry.register(new Scheme("http", new PlainSocketFactory(), 80));
	    registry.register(new Scheme("https", new FakeSocketFactory(), 443));
        HttpParams httpparams = new BasicHttpParams();
	    httpclient = new DefaultHttpClient(new ThreadSafeClientConnManager(httpparams, registry), httpparams);
 
	    if (!baseURL.endsWith("/")) baseURL += "/";
	    this.baseURL = baseURL;
	} 
 
	public String doLogin(String username, String password) {
	    HttpPost httpost = new HttpPost(baseURL + "login");
 
	    try { 
		    httpost.setEntity(new StringEntity("{\"user\":{\"login\":\"" + username + "\",\"password\":\"" + password + "\"}}"));
5
CodeRank
This code example shows how to use the following methods:register
            HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
            HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
            HttpConnectionParams 
                    .setConnectionTimeout(params, connectionTimeout);
            HttpConnectionParams.setSoTimeout(params, socketTimeout);
 
            SchemeRegistry registry = new SchemeRegistry();
            registry.register(new Scheme("http", PlainSocketFactory
                    .getSocketFactory(), 80));
            registry.register(new Scheme("https", sf, 443));
 
            ClientConnectionManager ccm = new ThreadSafeClientConnManager(
                    params, registry);
 
            return new DefaultHttpClient(ccm, params);
        } catch (Exception e) {
            return new DefaultHttpClient();
        } 
    } 
 
5
CodeRank
This code example shows how to use the following methods:register
							params,
							"Mozilla/5.0 (Linux; U; Android 2.1; en-us; ADR6200 Build/ERD79) AppleWebKit/530.17 (KHTML, like Gecko) Version/ 4.0 Mobile Safari/530.17"); 
			ConnManagerParams.setTimeout(params, 1000);
			HttpConnectionParams.setConnectionTimeout(params, 5000);
			HttpConnectionParams.setSoTimeout(params, 10000);
			SchemeRegistry schReg = new SchemeRegistry();
			schReg.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
			schReg.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
			ClientConnectionManager conMgr = new ThreadSafeClientConnManager(params, schReg);
			customHttpClient = new DefaultHttpClient(conMgr, params);
		} 
		return customHttpClient;
	} 
 
	public static String getString(final String uri) {
 
		HttpGet httpGet = new HttpGet(uri);
		HttpResponse httpResponse = executeRequest(httpGet);
		return getHttpResonseAsString(httpResponse);
	} 
4
CodeRank
This code example shows how to use the following methods:register
 
        BasicHttpParams params = new BasicHttpParams();
        HttpConnectionParams.setConnectionTimeout(params, 45000);
        HttpConnectionParams.setSoTimeout(params, 30000);
 
        SchemeRegistry registry = new SchemeRegistry();
        registry.register(new Scheme("http", new PlainSocketFactory(), 80));
        try { 
            registry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
        } catch (Exception e) {
            Log.w(LOGTAG, "Unable to register HTTPS socket factory: " + e.getLocalizedMessage());
        } 
 
        ThreadSafeClientConnManager connManager = new ThreadSafeClientConnManager(params, registry);
        httpClient = new DefaultHttpClient(connManager, params);
    } 
 
    private static String stringFromInputStream(InputStream is) throws IOException
    { 
        char[] buf = new char[1024];
5
CodeRank
This code example shows how to use the following methods:register
This code example shows how to use the following methods:register
		HttpConnectionParams.setSoTimeout(params, SOCKET_OPERATION_TIMEOUT);
		HttpConnectionParams.setSocketBufferSize(params, 8192);
 
		HttpClientParams.setRedirecting(params, false);
 
		SchemeRegistry schemeRegistry = new SchemeRegistry();
		String protocol = config.getProtocol();
		int port = Integer.valueOf(config.getPort()).intValue();
 
		if (protocol.equalsIgnoreCase("http")) {
			schemeRegistry.register(new Scheme(protocol, PlainSocketFactory.getSocketFactory(), port));
		} else if (protocol.equalsIgnoreCase("https")) {
			schemeRegistry.register(new Scheme(protocol, SSLCertificateSocketFactory.getHttpSocketFactory(60000, null), port));
		} else { 
			throw new RuntimeException("HttpClientFactory: Can't create HttpClient with protocol " + protocol);
		} 
 
		ClientConnectionManager manager = new ThreadSafeClientConnManager(params, schemeRegistry);
 
		client = new DefaultHttpClient(manager, params);
5
CodeRank

Related SchemeRegistry register Questions & Answers:

register Method Overview
Registers a scheme.
See Code Examples for other Android SchemeRegistry Methods: