JdbcAddressRepository extends JdbcHelper implements AddressRepository { @Override public BitmessageAddress findContact(byte[] ripeOrTag) { for (BitmessageAddress address : find("public_key is null")) { if (address.getVersion() > 3) { if (Arrays.equals(ripeOrTag, address.getTag())) return address; } else { if (Arrays.equals(ripeOrTag, address.getRipe())) return address; } } return null; } JdbcAddressRepository(JdbcConfig config); @Override BitmessageAddress findContact(byte[] ripeOrTag); @Override BitmessageAddress findIdentity(byte[] ripeOrTag); @Override List<BitmessageAddress> getIdentities(); @Override List<BitmessageAddress> getChans(); @Override List<BitmessageAddress> getSubscriptions(); @Override List<BitmessageAddress> getSubscriptions(long broadcastVersion); @Override List<BitmessageAddress> getContacts(); @Override void save(BitmessageAddress address); @Override void remove(BitmessageAddress address); @Override BitmessageAddress getAddress(String address);  }
@Test public void testFindContact() throws Exception { BitmessageAddress address = new BitmessageAddress(CONTACT_A); assertEquals(4, address.getVersion()); assertEquals(address, repo.findContact(address.getTag())); assertNull(repo.findIdentity(address.getTag())); }