Out with Callback in with (react) RFuture.

A service that used to use a Callback now uses RFuture:

  interface FooService extends NexusService {
-    void fooMyBar (int times, Callback<String> callback);
+    RFuture<String> fooMyBar (int times);
  }

The implementor of the service changes thusly:

  class FooManager implements FooService {
-    void fooMyBar (int times, Callback<String> callback) {
-      callback.onComplete("Yee-haw!");
+    RFuture<String> fooMyBar (int times) {
+      return RFuture.success("Yee-haw!");
    }
  }

The caller of the service changes thusly:

- obj.svc.get().fooMyBar(new Callback<String>() { ... });
+ obj.svc.get().fooMyBar().
+   onSuccess(new Slot<String>() { ... }).
+   onFailure(new Slot<Throwable>() { ... });

Oh noes, the verbosity, you might be saying. But actually, this makes service
calls much more composable, and in my experience thus far as resulted in less
code, rather than more.

Quite often, error handling is the same regardless of the service being called,
so you might now have a method like:

  Slot<Throwable> reportFailure (final String errpre) {
    return new Slot<Throwable>() { public void onEmit (Throwable cause) {
      // combine errpre and cause as desired and report as desired
    };
  }

Then for half a dozen service calls, instead of having:

  obj.svc.get().doThang(new Callback<Bammo>() {
    public void onSuccess (Bammo bammo) { ... }
    public void onFailure (Throwable cause) {
      // same damned error reporting code that I have half a dozen places
    }
  });

You just do:

  obj.svc.get().doThang().onSuccess(new Slot<Bammo>() {
    public void onEmit (Bammo bammo) { ... }
  }).onFailure(reportFailure("Failed to do thang"));

Here's another useful thing from the chat demo:

    _roomobj.roomSvc.get().sendMessage(message).
        bindComplete(new Slot<Boolean>() { public void onEmit (Boolean isComplete) {
            _entry.setEnabled(isComplete);
            send.setEnabled(isComplete);
        }}).
        onSuccess(new UnitSlot() { public void onEmit () {
            _entry.setText("");
            _entry.requestFocusInWindow();
        }}).
        onFailure(reportFailure("Chat send failed"));

RFuture.bindComplete() allows you to bind a slot to a value that represents
whether or not the result has been completed (succeeded or failed). The chat
demo uses this to disable the chat entry box until their chat message has
either succeeded or failed. If the chat demo used TriplePlay instead of Swing,
this would be the even svelter:

  blah.sendMessage(message).
    bindComplete(entry.enabledSlot()).
    bindComplete(send.enabledSlot()).
    ...

So many wires just ready for the connecting!

You can also map() and flatMap() the results of a service call. Mapping over
success and then potentially wiring the result directly into a Slot that you
already have because that's how you roll.

Object subscription has been revamped to work nicely with flatMap() (and as a
result, to be far more pleasant in general). You now create a Subscriber<T>
from NexusClient which is a function that maps an Address<N> to a RFuture<N>
(where N is a NexusObject), and you can do things like this:

    if (_sub != null) _sub.unsubscribe();
    _chatobj.chatSvc.get().joinRoom(name).
        flatMap(_sub = _ctx.getClient().subscriber()).
        onSuccess(joinedRoom).
        onFailure(reportFailure("Failed to join room '" + name + "'"));

    protected Subscriber<RoomObject> _sub;

where ChatService defines:

    RFuture<Address<RoomObject>> joinRoom (String name);

You can also just subscribe to an object straight up:

  (_sub = _client.subscriber()).
    subscribe(Address.create(host, FooObject.class)).
    onSuccess(new Slot<FooObject>() { ... }).
    onFailure(new Slot<Throwable>() { ... });

The assignment capturing _sub is so that you can use _sub to unsubscribe from
the object later. If you never need to unsubscribe, then you can omit it.

You can look at the diffs of things like Connection and NexusClient to see how
these changes removed huge swathes of code in there. This commit is +319 lines
and -610 lines. They may not provide such substantial simplification to your
code, but I'm confident they'll be a net win rather than a lose.

One more bonus: no more name clash with PlayN's Callback class. Yay!
Allow log formatting in NexusException.require().
Covariance shenanigans for Address.

Oh Java, use site variance annotations are so awesome.
Add a helper for unsubscribe and then subscribe.

Ended up not using this where I was planning to, but I think it's still useful
enough to provide.

It allows you to do something like this:

  protected Subscriber<FooObject> _sub;

  (_sub = _client.subscriber(_sub)).subscribe(...);

which will automatically unsubscribe your old sub and create your new one.
Really I want TriplePlay's Ref for this case, which I ended up using where I
was going to use this, but not everyone has/wants/can use TP's Ref.
Added NexusClient.closeAll().
Jesus fuck, use site variance is annoying.