public List<X509Certificate> getTrustedChainForServer(X509Certificate[] certs,
            String authType, Socket socket) throws CertificateException {
        SSLSession session = null;
        SSLParameters parameters = null;
        if (socket instanceof SSLSocket) {
            SSLSocket sslSocket = (SSLSocket) socket;
            session = getHandshakeSessionOrThrow(sslSocket);
            parameters = sslSocket.getSSLParameters();
        }
        return checkTrusted(certs, authType, session, parameters, false /* client auth */);
    }
Returns the full trusted certificate chain found from {@code certs}.
<p>
Throws {@link CertificateException} when no trusted chain can be found from {@code certs}.
common/src/main/java/org/conscrypt/TrustManagerImpl.java