Java 类org.apache.http.conn.scheme.LayeredSocketFactory 实例源码

项目:FMTech    文件:GoogleHttpClient.java   
private GoogleHttpClient(Context paramContext, String paramString, boolean paramBoolean)
{
  String str1 = paramString + " (" + Build.DEVICE + " " + Build.ID + ")";
  this.mClient = AndroidHttpClient.newInstance(str1 + "; gzip", paramContext);
  this.mCookieSourceApplier = new CookieSourceApplier(this.mClient, null, (byte)0);
  this.mResolver = paramContext.getContentResolver();
  this.mAppName = paramString;
  SchemeRegistry localSchemeRegistry = getConnectionManager().getSchemeRegistry();
  Iterator localIterator = localSchemeRegistry.getSchemeNames().iterator();
  if (localIterator.hasNext())
  {
    String str2 = (String)localIterator.next();
    Scheme localScheme = localSchemeRegistry.unregister(str2);
    SocketFactory localSocketFactory = localScheme.getSocketFactory();
    if ((localSocketFactory instanceof LayeredSocketFactory)) {}
    for (Object localObject = new WrappedLayeredSocketFactory((LayeredSocketFactory)localSocketFactory, (byte)0);; localObject = new WrappedSocketFactory(localSocketFactory, (byte)0))
    {
      localSchemeRegistry.register(new Scheme(str2, (SocketFactory)localObject, localScheme.getDefaultPort()));
      break;
    }
  }
}
项目:FMTech    文件:GoogleHttpClient.java   
private WrappedLayeredSocketFactory(LayeredSocketFactory paramLayeredSocketFactory)
{
  super(paramLayeredSocketFactory, (byte)0);
  this.mDelegate = paramLayeredSocketFactory;
}
项目:cJUnit-mc626    文件:DefaultClientConnectionOperator.java   
public void updateSecureConnection(OperatedClientConnection conn,
                                   HttpHost target,
                                   HttpContext context,
                                   HttpParams params)
    throws IOException {


    if (conn == null) {
        throw new IllegalArgumentException
            ("Connection must not be null.");
    }
    if (target == null) {
        throw new IllegalArgumentException
            ("Target host must not be null.");
    }
    if (params == null) {
        throw new IllegalArgumentException
            ("Parameters must not be null.");
    }
    if (!conn.isOpen()) {
        throw new IllegalArgumentException
            ("Connection must be open.");
    }

    final Scheme schm = schemeRegistry.getScheme(target.getSchemeName());
    if (!(schm.getSocketFactory() instanceof LayeredSocketFactory)) {
        throw new IllegalArgumentException
            ("Target scheme (" + schm.getName() +
             ") must have layered socket factory.");
    }

    final LayeredSocketFactory lsf = (LayeredSocketFactory) schm.getSocketFactory();
    final Socket sock; 
    try {
        sock = lsf.createSocket
            (conn.getSocket(), target.getHostName(), target.getPort(), true);
    } catch (ConnectException ex) {
        throw new HttpHostConnectException(target, ex);
    }
    prepareSocket(sock, context, params);
    conn.update(sock, target, lsf.isSecure(sock), params);
}