sSHClient.registerX11Forwarder(new ConnectListener() { @Override public void gotConnect(Forwarded chan) throws IOException { //How to use this method } }