In the Smack 4.0.x I could change the method proceedTLSReceived and access the method notifyConnectionError in the XMPPTCPConnection class by inheritance.
Now, in the Smack 4.1 it became private and I don’t have access to it anymore (unless I change the Smack code).
So I’d like to ask if these things could be protected in the XMPPTCPConnection:
The first three changes were requested because I did some personal modifications in the TLS setup so that I have to override the proceedTLSReceived method and use the socket to wrap my input/output streams. In the end I set the usingTLS = true. I do that extending the XMPPTCPConnection class.
The notifyConnectionError I use in my custom PingFailedListener:
public class ReconnectPingFailedListener implements PingFailedListener {
** private XMPPConnection connection;**
** public ReconnectPingFailedListener(XMPPConnection connection) {**
** this.connection = connection;**
** }**
** @Override**
** public void pingFailed() {**
** if (connection instanceof XMPPTCPConnection) {**
personal modifications in the TLS setup
What are those modifications?
The notifyConnectionError I use in my custom PingFailedListener:
Why don’t you just install a ping failed listener and shut down the connection when it’s called?
personal modifications in the TLS setup
What are those modifications?
Since the android doesn’t support some elliptic curves, I’m using the BouncyCastle to do the work. But this is not general. It’s very specific for my project.
The notifyConnectionError I use in my custom PingFailedListener:
Why don’t you just install a ping failed listener and shut down the connection when it’s called?
If I shutdown the connection, the ReconnectionManager will not try to reconnect again (the done flag will be true).
personal modifications in the TLS setup
What are those modifications?
Since the android doesn’t support some elliptic curves, I’m using the BouncyCastle to do the work. But this is not general. It’s very specific for my project.
Can’t you use a custom SSLContext to use BouncyCastle for TLS?
The notifyConnectionError I use in my custom PingFailedListener:
Why don’t you just install a ping failed listener and shut down the connection when it’s called?
If I shutdown the connection, the ReconnectionManager will not try to reconnect again (the done flag will be true).
I usually don’t recommend using the ReconnectionManager on Android, as you will also need to add some further reconnection logic on a mobile device. But even if you want to use it, why not simply reconnect after the instantShutdown/disconnect in the ping failed listener?
Can’t you use a custom SSLContext to use BouncyCastle for TLS?
Actually no, because the BouncyCastle TLS API is not compatible with JSSE.
I usually don’t recommend using the ReconnectionManager on Android, as you will also need to add some further reconnection logic on a mobile device. But even if you want to use it, why not simply reconnect after the instantShutdown/disconnect in the ping failed listener?
In my case the ReconnectionManager is working nicely. I tried to disconnect and connect in the ping failed listener, but it happened that sometimes (due to bad 3G signal) the connection establishment times out and it throws a ConnectionException. I could add a loop to try another connection establishment after some seconds, but in this way, I’m reimplementing the ReconnectionManager logic.