title: How to return one of the in-parameters in gmock
body: <p>I thought this sounded simple enough but i cannot seem to figure out how to do it.. I'm mocking a linux socket interface using this mock function:</p>
  
  <pre><code>MOCK_CONST_METHOD4(send, int(int socketDescriptor, const void* buffer, size_t n, int flags));
  </code></pre>
  
  <p>I want to return the number of bytes written with <code>send</code>.</p>
  
  <p>One idea was this:</p>
  
  <pre><code>  uint32_t nBytes = 0;
  
    EXPECT_CALL(socketMock, send(124, _, _, MSG_NOSIGNAL))
      .WillOnce(DoAll(SaveArg&lt;2&gt;(&amp;nBytes),
                      Return(nBytes)));
  </code></pre>
  
  <p>But this will always return zero.</p>
  
  <p>What should i do instead to <code>Return(Arg&lt;2&gt;)</code>?</p>