title: Targeting nested method with sinon and proxyquire
body: <p>For the following snippet of <code>nodejs</code> code, how would I stub the <code>send</code> method using <code>proxyquire</code> and <code>sinon</code>, given that this belongs to file <code>index.js</code>?
  I have tried many ways but constantly get errors.</p>
  
  <pre><code>var emailjs = require("emailjs");
  emailjs.server.connect({
                      user: obj.user,
                      password: obj.password,
                      host: obj.host,
                      port: obj.port,
                      tls: obj.tls,
                      ssl: obj.ssl
                  })
                      .send(mailOptions, function(error, message){
                      if (error) {
                          console.log("ERROR");
                          context.done(new Error("There was an error sending the email: %s", error));
                          return;
                      } else {
                          console.log("SENT");
                          context.done();
                          return;
                      }
                  });
  </code></pre>
  
  <p>So far in my tests I have the following set-up, but get <code>Uncaught TypeError: Property 'connect' of object #&lt;Object&gt; is not a function</code>.</p>
  
  <pre><code>readFileStub = sinon.stub();
  sendStub = sinon.stub();
  connectStub = sinon.stub().returns(sendStub);
  
  testedModule = proxyquire('../index', {
    'fs': {readFile: readFileStub},
    'emailjs': {
      'server': {
        'connect': {
           'send': sendStub
        }
      }
    }
  });
  </code></pre>