List of usage examples for org.apache.http.impl NoConnectionReuseStrategyHC4 NoConnectionReuseStrategyHC4
public NoConnectionReuseStrategyHC4()
From source file:org.thoughtcrime.securesms.mms.MmsConnection.java
protected CloseableHttpClient constructHttpClient() throws IOException { RequestConfig config = RequestConfig.custom().setConnectTimeout(20 * 1000) .setConnectionRequestTimeout(20 * 1000).setSocketTimeout(20 * 1000).setMaxRedirects(20).build(); return HttpClients.custom().setConnectionReuseStrategy(new NoConnectionReuseStrategyHC4()) .setRedirectStrategy(new LaxRedirectStrategy()).setUserAgent("Android-Mms/2.0") .setConnectionManager(new BasicHttpClientConnectionManager()).setDefaultRequestConfig(config) .build();//from ww w.ja v a2 s .co m }
From source file:org.whispersystems.mmsmonster.mms.MmsConnection.java
protected CloseableHttpClient constructHttpClient() throws IOException { RequestConfig config = RequestConfig.custom().setConnectTimeout(20 * 1000) .setConnectionRequestTimeout(20 * 1000).setSocketTimeout(20 * 1000).setMaxRedirects(20).build(); URL mmsc = new URL(apn.getMmsc()); CredentialsProvider credsProvider = new BasicCredentialsProvider(); if (apn.hasAuthentication()) { credsProvider.setCredentials(/* w w w . ja v a2 s. c om*/ new AuthScope(mmsc.getHost(), mmsc.getPort() > -1 ? mmsc.getPort() : mmsc.getDefaultPort()), new UsernamePasswordCredentials(apn.getUsername(), apn.getPassword())); } return HttpClients.custom().setConnectionReuseStrategy(new NoConnectionReuseStrategyHC4()) .setRedirectStrategy(new LaxRedirectStrategy()).setUserAgent("Android-Mms/2.0") .setConnectionManager(new BasicHttpClientConnectionManager()).setDefaultRequestConfig(config) .setDefaultCredentialsProvider(credsProvider).build(); }
From source file:com.tingtingapps.securesms.mms.LegacyMmsConnection.java
protected CloseableHttpClient constructHttpClient() throws IOException { RequestConfig config = RequestConfig.custom().setConnectTimeout(20 * 1000) .setConnectionRequestTimeout(20 * 1000).setSocketTimeout(20 * 1000).setMaxRedirects(20).build(); URL mmsc = new URL(apn.getMmsc()); CredentialsProvider credsProvider = new BasicCredentialsProvider(); if (apn.hasAuthentication()) { credsProvider.setCredentials(/*from w ww . ja v a2 s.c o m*/ new AuthScope(mmsc.getHost(), mmsc.getPort() > -1 ? mmsc.getPort() : mmsc.getDefaultPort()), new UsernamePasswordCredentials(apn.getUsername(), apn.getPassword())); } return HttpClients.custom().setConnectionReuseStrategy(new NoConnectionReuseStrategyHC4()) .setRedirectStrategy(new LaxRedirectStrategy()) .setUserAgent(TextSecurePreferences.getMmsUserAgent(context, USER_AGENT)) .setConnectionManager(new BasicHttpClientConnectionManager()).setDefaultRequestConfig(config) .setDefaultCredentialsProvider(credsProvider).build(); }
From source file:org.smssecure.smssecure.mms.LegacyMmsConnection.java
protected CloseableHttpClient constructHttpClient() throws IOException { RequestConfig config = RequestConfig.custom().setConnectTimeout(20 * 1000) .setConnectionRequestTimeout(20 * 1000).setSocketTimeout(20 * 1000).setMaxRedirects(20).build(); URL mmsc = new URL(apn.getMmsc()); CredentialsProvider credsProvider = new BasicCredentialsProvider(); if (apn.hasAuthentication()) { credsProvider.setCredentials(/*from w w w . jav a 2 s . c om*/ new AuthScope(mmsc.getHost(), mmsc.getPort() > -1 ? mmsc.getPort() : mmsc.getDefaultPort()), new UsernamePasswordCredentials(apn.getUsername(), apn.getPassword())); } return HttpClients.custom().setConnectionReuseStrategy(new NoConnectionReuseStrategyHC4()) .setRedirectStrategy(new LaxRedirectStrategy()) .setUserAgent(SilencePreferences.getMmsUserAgent(context, USER_AGENT)) .setConnectionManager(new BasicHttpClientConnectionManager()).setDefaultRequestConfig(config) .setDefaultCredentialsProvider(credsProvider).build(); }