Example usage for org.apache.http.conn.scheme SchemeLayeredSocketFactory isSecure

List of usage examples for org.apache.http.conn.scheme SchemeLayeredSocketFactory isSecure

Introduction

In this page you can find the example usage for org.apache.http.conn.scheme SchemeLayeredSocketFactory isSecure.

Prototype

boolean isSecure(Socket sock) throws IllegalArgumentException;

Source Link

Document

Checks whether a socket provides a secure connection.

Usage

From source file:org.apache.http.impl.conn.DefaultClientConnectionOperator.java

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);
}