Introduce a new middleware API

This changeset deeply changes the middleware API. The spirit stays the
same, but everything has been (at least) renamed, pre-existing
middlewares will unconditionally break. The new API:

- is much more clear;
- offers better instrumentation opportunities (e.g: call tracing or the
  Raven/Sentry middleware).

The following hooks changed:

- call_procedure has been replaced by server_before_exec and
  server_after_exec, there is two reasons for this:
  * while kinda elegant it wouldn't allow any context (like the request
    or reply event) to be passed to the middleware because it had to
    take the exact same argument as the real (i.e: the served) method to
    be called;
  * I think two hooks are more clear here.
- inspect_error has been renamed to server_inspect_exception for clarity;
- raise_error has been replaced by client_handle_remote_error, not only
  the name is more clear, but it also return the new exception instead
  of raising it, which leave the liberty to the middleware to just
  inspect the exception on the client side (by returning nothing);

The hooks also receive much more context than before (mainly via request
and reply events objects).

Two new client hooks are introduced:

- client_before_request: called before the request is sent to the
  server;
- client_after_request: called when an answer or a timeout has been
  received from the server.

Unit tests have been added and updated accordingly. Moreover, PUB/SUB
tests showed errors which seem to be an independent problem from this
changeset and originate from pyzmq/libzmq directly; thus they have been
disabled (you can use nose --no-skip to run them).
Remove the client_return_answer hook from the list

This hook was already removed (it was redundant with
client_after_request).
Fix the PUB/SUB tests

FX kindly reminded that the Subscriber must be reading on the ZMQ socket
*before* the send from the publisher to get the message. In other words,
the test failures were a perfectly expected behavior from ZMQ.

Thus, this changeset add some retry logic to give the time to the
subscriber.run coroutine to trigger a read.
Pass the request event to the client_after_request hook

This is useful to get some context on the current task when the reply
event is None (either because we are timing out or because we are
talking to a PUSH/PULL or PUB/SUB).

It also replaces the useless method argument from the patterns.
bump version to v0.4.0
Add argparse as install requirement only when Python < 2.7
Fix indentation
Fix AttributeError on timeout with async

oc = zerorpc.Client(connect_to="tcp://127.0.0.1:8003")
oc.test('whats up', async=True).wait()

If there is a timeout:
An exception is raised: "AttributeError: 'str' object has no attribute 'name'"

Thanks jvangael for the bug report.

This patch also add a test case.
bump version to v0.4.1
Merge pull request #52 from maxpersson/setup.py-argparse

Add argparse as install requirement only when Python < 2.7
Harden zerorpc against malformed msgpack messages.

If an error occur while receiving a message in a channel multiplexer,
the error will be ignored, and a detailed error will be printed out on
stderr.

This will keep your service running when receiving broken messages.
remove useless code
Moving zerorpc to an entry_point

When using 'scripts', the scripts are installed as-is, which is a problem with:
* easy_install-in on Windows -- no executable wrapper is created
* buildout environments -- no wrapper is created

When using console_scripts entry points, all of these are created just fine.
The switch is simple and easy and does not break anything, but it does moving the 'zerorpc' script inside the package
Add back bin/zerorpc, now a tiny wrapper.

This small wrapper is here when you want to run zerorpc without
installing it, for some testing or any specific development
environment.
Update README.rst

minor spelling and continuity corrections
Merge pull request #55 from aelse/patch-1

Update README.rst
Follow updates on pyzmq 13.0.0

 - XREP/XREQ constants are now definitively replaced by ROUTER/DEALER.
 - Some weird getattr/setattr magic were added to pyzmq, which makes
   inheriting from pyzmq classes annoyingly frustrating, especially:
	- zmq.Context: solved by defined attributes wiht None, at the class
	  level.
	- zmq.Socket: solved by using self.__dict__ directly.
update test, to help reproduce bug in travis

It seems that Travis has something special that makes some test crash
pretty bad. Its really hard if not impossible to reproduce, for now I
extended the heartbeat frequency of the tests to 2 seconds (to be longer
than the maximum wait on the (py)ZMQ bug of missing events). I also used
a gevent.Pool to forward exceptions.
"Less ugly" fix for context.py and clarify comments about pyzmq 13.0.0