/** * Starts a {@link PortForwarder} accepting remotely at the given channel, * which connects by using the given connector. * * @return * A {@link Closeable} that can be used to shut the port forwarding down. */ public static ListeningPort create(VirtualChannel ch, final int acceptingPort, Forwarder forwarder) throws IOException, InterruptedException { // need a remotable reference final Forwarder proxy = ch.export(Forwarder.class, forwarder); return ch.call(new Callable<ListeningPort,IOException>() { public ListeningPort call() throws IOException { PortForwarder t = new PortForwarder(acceptingPort, proxy); t.start(); return Channel.current().export(ListeningPort.class,t); } }); }
/** * Starts a {@link PortForwarder} accepting remotely at the given channel, * which connects by using the given connector. * * @return * A {@link Closeable} that can be used to shut the port forwarding down. */ public static ListeningPort create(VirtualChannel ch, final int acceptingPort, Forwarder forwarder) throws IOException, InterruptedException { // need a remotable reference final Forwarder proxy = ch.export(Forwarder.class, forwarder); return ch.call(new Callable<ListeningPort,IOException>() { public ListeningPort call() throws IOException { PortForwarder t = new PortForwarder(acceptingPort, proxy); t.start(); return Channel.current().export(ListeningPort.class,t); } }); }
/** * Starts a {@link PortForwarder} accepting remotely at the given channel, * which connects by using the given connector. * * @return * A {@link Closeable} that can be used to shut the port forwarding down. */ public static ListeningPort create(VirtualChannel ch, final int acceptingPort, Forwarder forwarder) throws IOException, InterruptedException { // need a remotable reference final Forwarder proxy = ch.export(Forwarder.class, forwarder); return ch.call(new Callable<ListeningPort,IOException>() { public ListeningPort call() throws IOException { PortForwarder t = new PortForwarder(acceptingPort, proxy); t.start(); return Channel.current().export(ListeningPort.class,t); } }); }
/** * Starts a {@link PortForwarder} accepting remotely at the given channel, * which connects by using the given connector. * * @return * A {@link Closeable} that can be used to shut the port forwarding down. */ public static ListeningPort create(VirtualChannel ch, final int acceptingPort, Forwarder forwarder) throws IOException, InterruptedException { // need a remotable reference final Forwarder proxy = ch.export(Forwarder.class, forwarder); return ch.call(new ListeningPortCallable(acceptingPort, proxy)); }