@Test public void supplyReconnectDataAndInformReconnectListenerWhenReconnectionStarts() { when(reconnectDataSupplier.getReconnectData()).thenReturn(new LeaseReconnectData(1)); LeaseEndpointDelegate delegate = new LeaseEndpointDelegate(reconnectListener, reconnectDataSupplier); byte[] bytes = delegate.createExtendedReconnectData(); LeaseReconnectData recoveredReconnectData = LeaseReconnectData.decode(bytes); assertEquals(1, recoveredReconnectData.getConnectionSequenceNumber()); verify(reconnectListener).reconnecting(); }
@Override public byte[] createExtendedReconnectData() { reconnectListener.reconnecting(); LeaseReconnectData reconnectData = reconnectDataSupplier.getReconnectData(); return reconnectData.encode(); }
LeaseEndpointDelegate implements EndpointDelegate<LeaseResponse> { @Override public byte[] createExtendedReconnectData() { reconnectListener.reconnecting(); LeaseReconnectData reconnectData = reconnectDataSupplier.getReconnectData(); return reconnectData.encode(); } }
LeaseEndpointDelegate implements EndpointDelegate<LeaseResponse> { @Override public byte[] createExtendedReconnectData() { reconnectListener.reconnecting(); LeaseReconnectData reconnectData = reconnectDataSupplier.getReconnectData(); return reconnectData.encode(); } LeaseEndpointDelegate(LeaseReconnectListener reconnectListener, LeaseReconnectDataSupplier reconnectDataSupplier); }
LeaseEndpointDelegate implements EndpointDelegate<LeaseResponse> { @Override public byte[] createExtendedReconnectData() { reconnectListener.reconnecting(); LeaseReconnectData reconnectData = reconnectDataSupplier.getReconnectData(); return reconnectData.encode(); } LeaseEndpointDelegate(LeaseReconnectListener reconnectListener, LeaseReconnectDataSupplier reconnectDataSupplier); @Override void handleMessage(LeaseResponse entityResponse); @Override byte[] createExtendedReconnectData(); @Override void didDisconnectUnexpectedly(); }
LeaseEndpointDelegate implements EndpointDelegate<LeaseResponse> { @Override public byte[] createExtendedReconnectData() { reconnectListener.reconnecting(); LeaseReconnectData reconnectData = reconnectDataSupplier.getReconnectData(); return reconnectData.encode(); } LeaseEndpointDelegate(LeaseReconnectListener reconnectListener, LeaseReconnectDataSupplier reconnectDataSupplier); @Override void handleMessage(LeaseResponse entityResponse); @Override byte[] createExtendedReconnectData(); @Override void didDisconnectUnexpectedly();  }