@Test public void handleExpiredPacket() { new IldcpResponsePacketHandler() { @Override protected void handleIldcpResponsePacket(IldcpResponsePacket ildcpResponsePacket) { fail("Cannot handle expired packet"); throw new RuntimeException("Should not fulfill!"); } @Override protected void handleIldcpErrorPacket(InterledgerRejectPacket ildcpErrorPacket) { assertThat(ildcpErrorPacket.getCode()).isEqualTo(InterledgerErrorCode.R00_TRANSFER_TIMED_OUT); } }.handle(expiredPacket); }
public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpErrorPacket((InterledgerRejectPacket) responsePacket); } else { throw new RuntimeException( String.format("Unsupported IldcpResponsePacket Type: %s", responsePacket.getClass())); } }
IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpErrorPacket((InterledgerRejectPacket) responsePacket); } else { throw new RuntimeException( String.format("Unsupported IldcpResponsePacket Type: %s", responsePacket.getClass())); } } }
IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpErrorPacket((InterledgerRejectPacket) responsePacket); } else { throw new RuntimeException( String.format("Unsupported IldcpResponsePacket Type: %s", responsePacket.getClass())); } }  }
IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpErrorPacket((InterledgerRejectPacket) responsePacket); } else { throw new RuntimeException( String.format("Unsupported IldcpResponsePacket Type: %s", responsePacket.getClass())); } }  final void handle(final InterledgerResponsePacket responsePacket); }
IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpErrorPacket((InterledgerRejectPacket) responsePacket); } else { throw new RuntimeException( String.format("Unsupported IldcpResponsePacket Type: %s", responsePacket.getClass())); } }  final void handle(final InterledgerResponsePacket responsePacket);  }