How to create SSH connection with "-s xmlagent" or "netconf" option

Lee Painter

The -s switch on the SSH command line indicates that the server should start a subsystem.

The equivilent way of doing this in our client is to get hold of an Ssh2Session instance

Ssh2Session session = (Ssh2Session) ssh.openSessionChannel();

Then call its startSubsystem method

session.startSubsystem("xmlagent");

The InputStream/OutputStream of the session can then be used to communicate with that subsystem.