Sorry for that. Feel free to raise a JIRA to add back a isClosed() method
or something similar.
As a workaround, one way would be to add a global session listener:
client = SshClient.setUpDefaultClient();
client.start();
client.getSessionFactory().addListener(myListener);
...
The listener will be called whenever a session is closed, though you have
to maintain the state yourself.
A better option would be to subclass ClientSessionImpl and access the state
using
public class MyClientSessionImpl extends ClientSessionImpl {
public isClosed() {
return closeFuture.isClosed();
}
...
}
You can then use your derived class using something like:
client = SshClient.setUpDefaultClient();
SessionFactory factory = new SessionFactory() {
@Override
protected AbstractSession doCreateSession(IoSession ioSession)
throws Exception {
return new MyClientSessionImpl(client, ioSession);
}
};
factory.setClient(client);
client.setSessionFactory(factory);
client.start();
You can then use
((MyClientSessionImpl) session).isClosed()
2014-04-30 22:51 GMT+02:00 Darren Shepherd <[email protected]>:
> I'm upgrading from sshd-core 0.9.0 to 0.11.0 and previously there was
> a ClientSession.getState() method that I was using to tell if the
> session has been closed. That method is gone now. What can I use to
> tell if the ClientSession is open or closed?
>
> Darren
>