public static TrustManager [ ] decorate ( TrustManager [ ] trustManagers , TLSConfig tlsConfig ) { if ( null != trustManagers && trustManagers . length > 0 ) { TrustManager [ ] decoratedTrustManagers = new TrustManager [ trustManagers . length ] ; for ( int i = 0 ; i < trustManagers . length ; ++ i ) { TrustManager trustManager = trustManagers [ i ] ; if ( trustManager instanceof X509TrustManager ) { decoratedTrustManagers [ i ] = new ClientX509ExtendedTrustManager ( ( X509TrustManager ) trustManager , tlsConfig ) ; } else { decoratedTrustManagers [ i ] = trustManager ; } } return decoratedTrustManagers ; } return trustManagers ; }
This method converts existing X509TrustManagers to ClientX509ExtendedTrustManagers .