<s> import sys <EOL> import time <EOL> import monocle <EOL> from monocle import _o <EOL> monocle . init ( sys . argv [ <NUM_LIT:1> ] ) <EOL> from monocle . stack import eventloop <EOL> from monocle . stack . network import add_service , Service , Client , ConnectionLost <EOL> @ _o <EOL> def pump ( input , output ) : <EOL> while True : <EOL> try : <EOL> message = yield input . read_some ( ) <EOL> yield output . write ( message ) <EOL> except ConnectionLost : <EOL> output . close ( ) <EOL> break <EOL> @ _o <EOL> def handle_socks ( conn ) : <EOL> client = Client ( ) <EOL> yield client . connect ( '<STR_LIT:localhost>' , <NUM_LIT> ) <EOL> monocle . launch ( pump , conn , client ) <EOL> yield pump ( client , conn ) <EOL> add_service ( Service ( handle_socks , port = <NUM_LIT> ) ) <EOL> eventloop . run ( ) </s>
