Implement Validate message reply seq ids
diff --git a/lib/rb/lib/thrift/client.rb b/lib/rb/lib/thrift/client.rb
index 64ef059..5c7cd98 100644
--- a/lib/rb/lib/thrift/client.rb
+++ b/lib/rb/lib/thrift/client.rb
@@ -50,9 +50,17 @@
@oprot.trans.flush
end
- def receive_message(result_klass)
+ def receive_message_begin()
fname, mtype, rseqid = @iprot.read_message_begin
- handle_exception(mtype)
+ [fname, mtype, rseqid]
+ end
+
+ def reply_seqid(rseqid)
+ result = (rseqid==@seqid)?true:false
+ result
+ end
+
+ def receive_message(result_klass)
result = result_klass.new
result.read(@iprot)
@iprot.read_message_end
diff --git a/lib/rb/spec/client_spec.rb b/lib/rb/spec/client_spec.rb
index d5d4cee..f015d66 100644
--- a/lib/rb/spec/client_spec.rb
+++ b/lib/rb/spec/client_spec.rb
@@ -69,6 +69,7 @@
expect(@prot).to receive(:read_message_end)
mock_klass = double("#<MockClass:mock>")
expect(mock_klass).to receive(:read).with(@prot)
+ @client.receive_message_begin()
@client.receive_message(double("MockClass", :new => mock_klass))
end
@@ -80,7 +81,8 @@
expect(mock_exc).to receive(:read).with(@prot)
end
end
- expect { @client.receive_message(nil) }.to raise_error(StandardError)
+ fname, mtype, sqeid = @client.receive_message_begin()
+ expect { @client.handle_exception(mtype) }.to raise_error(StandardError)
end
it "should close the transport if an error occurs while sending a message" do