LeaseEndpointDelegate implements EndpointDelegate<LeaseResponse> { @Override public void handleMessage(LeaseResponse entityResponse) { if (!(entityResponse instanceof LeaseAcquirerAvailable)) { throw new AssertionError("Received unexpected message from server: " + entityResponse); } reconnectListener.reconnected(); } LeaseEndpointDelegate(LeaseReconnectListener reconnectListener, LeaseReconnectDataSupplier reconnectDataSupplier); @Override void handleMessage(LeaseResponse entityResponse); @Override byte[] createExtendedReconnectData(); @Override void didDisconnectUnexpectedly();  }
@Test public void messageFromServerInformsAboutReconnectedStatus() { LeaseEndpointDelegate delegate = new LeaseEndpointDelegate(reconnectListener, reconnectDataSupplier); delegate.handleMessage(new LeaseAcquirerAvailable()); verify(reconnectListener).reconnected(); }