下面列出了怎么用org.jivesoftware.smack.ConnectionListener的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Creates a new XMPP connection over TCP (optionally using proxies).
* <p>
* Note that XMPPTCPConnection constructors do not establish a connection to the server
* and you must call {@link #connect()}.
* </p>
*
* @param config the connection configuration.
*/
public XMPPTCPConnection(XMPPTCPConnectionConfiguration config) {
super(config);
this.config = config;
addConnectionListener(new ConnectionListener() {
@Override
public void connectionClosedOnError(Exception e) {
if (e instanceof XMPPException.StreamErrorException || e instanceof StreamManagementException) {
dropSmState();
}
}
});
// Re-init the reader and writer in case of SASL <success/>. This is done to reset the parser since a new stream
// is initiated.
buildNonzaCallback().listenFor(SaslNonza.Success.class, s -> resetParser()).install();
}
public ConnectionListener getConnectionListener() {
return connectionListener;
}
public ConnectionListener getConnectionListener() {
return connectionListener;
}
public ConnectionListener getConnectionListener() {
return connectionListener;
}