This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| """ | |
| Fabric tunneling utilities | |
| by [email protected] | |
| class ForwardServer and relates things are refere Robey Pointer's paramiko example. | |
| (http://bazaar.launchpad.net/~robey/paramiko/trunk/annotate/head%3A/demos/forward.py) | |
| usage:: | |
| with make_tunnel('[email protected]:10022') as t: |
| require 'rubygems' | |
| begin | |
| require 'jmx' | |
| rescue LoadError | |
| puts "This must be run under JRuby. Sorry" | |
| exit(1) | |
| end | |
| client = JMX.connect :host => 'localhost', :port => '9998' |
| import java.net.InetSocketAddress | |
| import java.util.concurrent.Executors | |
| import org.jboss.netty.bootstrap.ServerBootstrap | |
| import org.jboss.netty.channel.ChannelPipelineFactory | |
| import org.jboss.netty.channel.ChannelHandler | |
| import org.jboss.netty.channel.Channels | |
| import org.jboss.netty.channel.SimpleChannelUpstreamHandler | |
| import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory | |
| import org.jboss.netty.channel.MessageEvent |