/** * @return a {@link RemotePortForwarder} that allows requesting remote forwarding over this * connection. */ public RemotePortForwarder getRemotePortForwarder() { synchronized (conn) { RemotePortForwarder rpf = (RemotePortForwarder) conn.get(ForwardedTCPIPChannel.TYPE); if (rpf == null) conn.attach(rpf = new RemotePortForwarder(conn)); return rpf; } }
protected AbstractDirectChannel(Connection conn, String type) { super(conn, type); /* * We expect to receive channel open confirmation/rejection and want to be able to next this packet. */ conn.attach(this); }
/** * Register a {@code listener} for handling forwarded X11 channels. Without having done this, an * incoming X11 forwarding will be summarily rejected. * * <p>It should be clarified that multiple listeners for X11 forwarding over a single SSH * connection are not supported (and don't make much sense). So a subsequent call to this method * is only going to replace the registered {@code listener}. * * @param listener the {@link ConnectListener} that should be delegated the responsibility of * handling forwarded {@link X11Channel} 's * @return an {@link X11Forwarder} that allows to {@link X11Forwarder#stop() stop acting} on X11 * requests from server */ public X11Forwarder registerX11Forwarder(ConnectListener listener) { final X11Forwarder x11f = new X11Forwarder(conn, listener); conn.attach(x11f); return x11f; }