Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在华为mate20 android10系统反射不到setApplicationProtocols 类,是9.0 API限制吗,有什么解决办法 #77

Open
chenyang1900 opened this issue Oct 24, 2020 · 1 comment

Comments

@chenyang1900
Copy link

com.android.org.conscrypt.Java8EngineWrapper.setApplicationProtocols [class [Ljava.lang.String;]
java.lang.NoSuchMethodException: com.android.org.conscrypt.Java8EngineWrapper.setApplicationProtocols [class [Ljava.lang.String;]
at java.lang.Class.getMethod(Class.java:2072)
at java.lang.Class.getDeclaredMethod(Class.java:2050)
at com.github.megatronking.netbare.http.HttpSSLResponseCodec.enableJava8EngineWrapperAlpn(HttpSSLResponseCodec.java:110)
at com.github.megatronking.netbare.http.HttpSSLResponseCodec.enableAlpn(HttpSSLResponseCodec.java:94)
at com.github.megatronking.netbare.http.HttpSSLResponseCodec.createEngine(HttpSSLResponseCodec.java:62)
at com.github.megatronking.netbare.ssl.SSLResponseCodec.prepareHandshake(SSLResponseCodec.java:86)
at com.github.megatronking.netbare.http.HttpSSLResponseCodec.prepareHandshake(HttpSSLResponseCodec.java:87)
at com.github.megatronking.netbare.http.HttpSSLCodecInterceptor.intercept(HttpSSLCodecInterceptor.java:97)
at com.github.megatronking.netbare.http.HttpSSLCodecInterceptor.intercept(HttpSSLCodecInterceptor.java:38)
at com.github.megatronking.netbare.gateway.IndexedInterceptor.intercept(IndexedInterceptor.java:67)
at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:55)
at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:104)
at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:68)
at com.github.megatronking.netbare.http.HttpSniffInterceptor.intercept(HttpSniffInterceptor.java:35)
at com.github.megatronking.netbare.gateway.IndexedInterceptor.intercept(IndexedInterceptor.java:67)
at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:55)
at com.github.megatronking.netbare.http.HttpRequestChain.processNext(HttpRequestChain.java:32)
at com.github.megatronking.netbare.gateway.InterceptorChain.process(InterceptorChain.java:104)
at com.github.megatronking.netbare.http.HttpVirtualGateway.onSpecRequest(HttpVirtualGateway.java:121)
at com.github.megatronking.netbare.gateway.SpecVirtualGateway.onRequest(SpecVirtualGateway.java:69)
at com.github.megatronking.netbare.NetBareVirtualGateway.onRequest(NetBareVirtualGateway.java:88)
at com.github.megatronking.netbare.tunnel.TcpVATunnel$1.onRead(TcpVATunnel.java:90)
at com.github.megatronking.netbare.tunnel.NioTunnel.onRead(NioTunnel.java:101)
at com.github.megatronking.netbare.proxy.TcpProxyServer.process(TcpProxyServer.java:141)
at com.github.megatronking.netbare.proxy.BaseProxyServer.run(BaseProxyServer.java:62)
at com.github.megatronking.netbare.proxy.TcpProxyServer.run(TcpProxyServer.java:110)
at java.lang.Thread.run(Thread.java:929)

对应代码:
private void enableJava8EngineWrapperAlpn() throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
Method setApplicationProtocolsMethod = mSSLEngine.getClass().getDeclaredMethod(
"setApplicationProtocols", String[].class);
setApplicationProtocolsMethod.setAccessible(true);
String[] protocols = new String[mClientAlpns.length];
for (int i = 0; i < protocols.length; i++) {
protocols[i] = mClientAlpns[i].toString().toLowerCase();
}
setApplicationProtocolsMethod.invoke(mSSLEngine, new Object[]{protocols});

    Method setUseSessionTicketsMethod = mSSLEngine.getClass().getDeclaredMethod(
            "setUseSessionTickets", boolean.class);
    setUseSessionTicketsMethod.setAccessible(true);
    setUseSessionTicketsMethod.invoke(mSSLEngine, true);
}
@EricKong1985
Copy link

I also hit the same problem ,any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants