Sha256: d23f2f85cff0c69a28db550a35758dc34f336d5f68dfb23ddbcbdf5c91753e2f
Contents?: true
Size: 922 Bytes
Versions: 1
Compression:
Stored size: 922 Bytes
Contents
require 'test_helper' def assert_proxy(host, port, send, recv) sock = TCPSocket.new(host, port) sock.write(send) assert_equal recv, sock.read sock.close end class ProxymachineTest < Test::Unit::TestCase should "handle simple routing" do assert_proxy('localhost', 9990, 'a', '9980:a') assert_proxy('localhost', 9990, 'b', '9981:b') end should "handle connection closing" do sock = TCPSocket.new('localhost', 9990) sock.write('xxx') assert_equal nil, sock.read(1) sock.close end should "handle rewrite routing" do assert_proxy('localhost', 9990, 'c', '9980:ccc') end should "handle rewrite closing" do assert_proxy('localhost', 9990, 'd', 'ddd') end should "handle noop" do sock = TCPSocket.new('localhost', 9990) sock.write('e' * 2048) sock.flush sock.write('f') assert_equal '9980:' + 'e' * 2048 + 'f', sock.read sock.close end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
proxymachine-1.0.0 | test/proxymachine_test.rb |