public static TrustManager[] trustManager(boolean needAuth, String trustCertPath) {
        if (needAuth) {
            try {
                return trustCertPath == null ? null : buildSecureTrustManager(trustCertPath);
            } catch (SSLException e) {
                LOGGER.warn("degrade trust manager as build failed, " + "will trust all certs.");
                return trustAll;
            }
        } else {
            return trustAll;
        }
    }
@Test
    void testTrustManagerNonExist() throws CertificateException {
        TrustManager[] actual = SelfTrustManager.trustManager(true, "non-exist-cert.pem");
        assertNotNull(actual);
        assertEquals(1, actual.length);
        assertTrue(actual[0] instanceof X509TrustManager);
        assertTrue(actual[0].getClass().isAnonymousClass());
        X509TrustManager x509TrustManager = (X509TrustManager) actual[0];
        assertNull(x509TrustManager.getAcceptedIssuers());
        x509TrustManager.checkClientTrusted(null, "a");
        x509TrustManager.checkServerTrusted(null, "b");
    }