Skip to content

Instantly share code, notes, and snippets.

@btakita
Created May 24, 2011 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save btakita/989601 to your computer and use it in GitHub Desktop.
Save btakita/989601 to your computer and use it in GitHub Desktop.
describe UserService do
attr_reader :client_iprot, :client_iprot_transport, :client_oprot, :client_oprot_transport, :server_iprot, :server_iprot_transport, :server_oprot, :server_oprot_transport, :client, :server_handler, :server_processor
before do
@client_iprot_transport = ::Thrift::MemoryBufferTransport.new
@client_iprot = ::Thrift::BinaryProtocol.new(client_iprot_transport)
@client_oprot_transport = ::Thrift::MemoryBufferTransport.new
@client_oprot = ::Thrift::BinaryProtocol.new(client_iprot_transport)
@client = UserService::Client.new(client_iprot, client_oprot)
@server_iprot_transport = ::Thrift::MemoryBufferTransport.new
@server_iprot = ::Thrift::BinaryProtocol.new(server_iprot_transport)
@server_oprot_transport = ::Thrift::MemoryBufferTransport.new
@server_oprot = ::Thrift::BinaryProtocol.new(server_oprot_transport)
@server_handler = UserHandler.new
@server_processor = TcUser::Thrift::UserService::Processor.new(server_handler)
stub.proxy(client).send_message do
server_iprot_transport.write client_iprot_transport.instance_variable_get(:@buf).dup
server_processor.process(server_iprot, server_oprot)
client_iprot_transport.reset_buffer server_oprot_transport.instance_variable_get(:@buf).dup
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment