Test cases and small fixes

1. Added unit tests for analytics and some basic tests for the express server.
2.  The analytics example in `sample/basics` was based on Express 4.x. Changed it to make it runnable on 3.x
3.  If some records failed to get uploaded, add them to the queue to retry them. On `flush()`, the remote API responds back with the number of records it successfully pushed and the number that it failed. Add the number of failed ones back to the buffer. The records are processed sequentially so if 5 records are rejected, they will always be the last 5 ones.
     
Why would they be rejected? If they are, can they be retried and be expected to be accepted without modification?