ConnectorNov2016 implements Connector { @Override public Decoder.Response get(String caller, Transport.Target target, Pager pager, Map<String, ?> parameters) throws InterruptedException { String id = UUID.randomUUID().toString(); Encoder.Request request = encoder.get(caller, target, pager, parameters); Message message = new Message(id, request.toString()); String response = sender.send(message); Decoder.Response decoded = decoder.get(target, response); log.trace("{} \u2192 {}", message, response); if(pager.count() == decoded.count()) { pager.more(decoded.state(), decoded.count(), decoded.hasMorePages()); return decoded; } else { return new Decoder.Response() { @Override public List<Data> data() { return decoded.data(); } @Override public boolean hasMorePages() { return decoded.hasMorePages(); } @Override public String state() { return decoded.state(); } @Override public int count() { return decoded.count(); } @Override public Optional<Decoder.Error> error() { return Optional.of(() -> "Message counts do not match!"); } }; } } ConnectorNov2016(Transport.Version v, Encoder e, Decoder d, Sender s); @Override String describe(); @Override Decoder.Response get(String caller, Transport.Target target,
    Pager pager, Map<String, ?> parameters); @Override Decoder.Response put(String caller, Transport.Target target,
    Map<String, ?> parameters, Map<String, ?> fields); @Override Decoder.Response fetch(); @Override Pager pager(); @Override Pager pager(int pageSize, int offset, Pager.Filter f, Pager.Sorter s); @Override Sender sender();  }
@Test public void defaultFactory() throws Exception { Transport.Factory factory = Transport.defaultFactory(); Responder south = new DefaultResponder() { @Override public Response first(String state, Decoder.Pager p, Decoder.Parameters ps, Transport.Target t) { return DefaultResponse.fromData( merge(new HashMap<>(), Bank.bankId, "bank-x")); } }; Receiver receiver = new ReceiverNov2016(south, factory.codecs()); Sender sender = receiver::respond; Connector connector = factory.connector(sender); Decoder.Response response = connector.get("test", Transport.Target.bank, null); assertTrue(response.data().iterator().hasNext()); }