/** * Gets the method to invoke trying to minimize the effective * application of reflection. * * @param sslSocket Instance of the SSL socket to use in connection with server. * @return Method to call to indicate the server name of interest to the server. */ private static Method getMethod(SSLSocket sslSocket) { final Class<?> sslSocketClass = sslSocket.getClass(); final ServerNameIndicator instance = mSingleInstance.get(); if (instance == null) { return initFrom(sslSocketClass); } else if (instance.mSSLSocketClassRef.get() != sslSocketClass) { // the underlying class changed return initFrom(sslSocketClass); } else if (instance.mSetHostnameMethodRef == null) { // SNI not supported return null; } else { final Method cachedSetHostnameMethod = instance.mSetHostnameMethodRef.get(); return (cachedSetHostnameMethod == null) ? initFrom(sslSocketClass) : cachedSetHostnameMethod; } }
/** * Gets the method to invoke trying to minimize the effective * application of reflection. * * @param sslSocket Instance of the SSL socket to use in connection with server. * @return Method to call to indicate the server name of interest to the server. */ private static Method getMethod(SSLSocket sslSocket) { final Class<?> sslSocketClass = sslSocket.getClass(); final ServerNameIndicator instance = mSingleInstance.get(); if (instance == null) { return initFrom(sslSocketClass); } else if (instance.mSSLSocketClassRef.get() != sslSocketClass) { // the underlying class changed return initFrom(sslSocketClass); } else if (instance.mSetHostnameMethodRef == null) { // SNI not supported return null; } else { final Method cachedSetHostnameMethod = instance.mSetHostnameMethodRef.get(); return (cachedSetHostnameMethod == null) ? initFrom(sslSocketClass) : cachedSetHostnameMethod; } }