当前位置: 首页>>代码示例>>Java>>正文


Java OperatedClientConnection.update方法代码示例

本文整理汇总了Java中org.apache.http.conn.OperatedClientConnection.update方法的典型用法代码示例。如果您正苦于以下问题:Java OperatedClientConnection.update方法的具体用法?Java OperatedClientConnection.update怎么用?Java OperatedClientConnection.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.conn.OperatedClientConnection的用法示例。


在下文中一共展示了OperatedClientConnection.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateSecureConnection

import org.apache.http.conn.OperatedClientConnection; //导入方法依赖的package包/类
@Override
public void updateSecureConnection(
        final OperatedClientConnection conn,
        final HttpHost target,
        final HttpContext context,
        final HttpParams params) throws IOException {
    Args.notNull(conn, "Connection");
    Args.notNull(target, "Target host");
    Args.notNull(params, "Parameters");
    Asserts.check(conn.isOpen(), "Connection must be open");

    final SchemeRegistry registry = getSchemeRegistry(context);
    final Scheme schm = registry.getScheme(target.getSchemeName());
    Asserts.check(schm.getSchemeSocketFactory() instanceof SchemeLayeredSocketFactory,
        "Socket factory must implement SchemeLayeredSocketFactory");
    final SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
    final Socket sock = lsf.createLayeredSocket(
            conn.getSocket(), target.getHostName(), schm.resolvePort(target.getPort()), params);
    prepareSocket(sock, context, params);
    conn.update(sock, target, lsf.isSecure(sock), params);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:22,代码来源:DefaultClientConnectionOperator.java

示例2: updateSecureConnection

import org.apache.http.conn.OperatedClientConnection; //导入方法依赖的package包/类
public void updateSecureConnection(
        final OperatedClientConnection conn,
        final HttpHost target,
        final HttpContext context,
        final HttpParams params) throws IOException {
    if (conn == null) {
        throw new IllegalArgumentException("Connection may not be null");
    }
    if (target == null) {
        throw new IllegalArgumentException("Target host may not be null");
    }
    if (params == null) {
        throw new IllegalArgumentException("Parameters may not be null");
    }
    if (!conn.isOpen()) {
        throw new IllegalStateException("Connection must be open");
    }

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

    SchemeLayeredSocketFactory lsf = (SchemeLayeredSocketFactory) schm.getSchemeSocketFactory();
    Socket sock;
    try {
        sock = lsf.createLayeredSocket(
                conn.getSocket(), target.getHostName(), target.getPort(), params);
    } catch (ConnectException ex) {
        throw new HttpHostConnectException(target, ex);
    }
    prepareSocket(sock, context, params);
    conn.update(sock, target, lsf.isSecure(sock), params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:DefaultClientConnectionOperator.java

示例3: updateSecureConnection

import org.apache.http.conn.OperatedClientConnection; //导入方法依赖的package包/类
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);
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:43,代码来源:DefaultClientConnectionOperator.java


注:本文中的org.apache.http.conn.OperatedClientConnection.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。