簡體   English   中英

ejabberd和smack握手失敗了

[英]ejabberd and smack handshake fails

我在我的雲服務器上運行ejabberd,我認為它運行良好,因為我可以使用pidgin從我的PC連接到它。(ejabberdctl connected-users-number在我連接時回答1,在我離線時回答0。)

現在我嘗試使用smack包從我的android應用程序連接到if,並且我得到IOException:

javax.net.ssl.SSLHandshakeException: Handshake failed

Caused by: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb897c858: Failure in SSL library, usually a protocol error
error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol (external/openssl/ssl/s23_clnt.c:795 0xacf6bf89:0x00000000)
W/System.err﹕ at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
W/System.err﹕ at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318)

這是我的應用程序代碼:

XMPPTCPConnectionConfiguration.Builder config = XMPPTCPConnectionConfiguration.builder();
config.setSecurityMode(ConnectionConfiguration.SecurityMode.required);
config.setConnectTimeout(30000);
config.setUsernameAndPassword(username + "@" + service, password);
config.setServiceName(service);
config.setHost(host);
config.setCompressionEnabled(true);
config.setPort(port);
config.setDebuggerEnabled(true);
config.setSocketFactory(SSLSocketFactory.getDefault());

SmackConfiguration.DEBUG = true;
try {
    TLSUtils.acceptAllCertificates(config);
    XMPPTCPConnection connection = new XMPPTCPConnection(config.build());
    connection.connect();
    connection.login();

} catch (SmackException ex) {
    ex.printStackTrace();
    chatClient.setConnection(null);
} catch(IOException ex){
    ex.printStackTrace();
    chatClient.setConnection(null);                 
} catch ( XMPPException ex){
    ex.printStackTrace();
    chatClient.setConnection(null);                 
}catch (NoSuchAlgorithmException ex) {
    ex.printStackTrace();
    chatClient.setConnection(null);
}catch (KeyManagementException ex) {
    ex.printStackTrace();
    chatClient.setConnection(null);
}
return null;

我真的很感激任何幫助!!

如果服務器中未啟用SSL,請禁用SSL。 要禁用,

config.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM