ServerConfigurationPayload extends Payload implements PersistentPayload, Serializable { @Override public int size() { if (serializedSize < 0) { try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) { try (ObjectOutputStream out = new ObjectOutputStream(bos)) { out.writeObject(writeReplace()); } serializedSize = bos.toByteArray().length; } catch (IOException e) { serializedSize = 0; LOG.error("Error serializing", e); } } return serializedSize; } ServerConfigurationPayload(final @NonNull List<ServerInfo> serverConfig); @NonNull List<ServerInfo> getServerConfig(); @Override int size(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testSize() { ServerConfigurationPayload expected = new ServerConfigurationPayload(Arrays.asList(new ServerInfo("1", true))); assertTrue(expected.size() > 0); }