@Test(expected = CodecException.class) public void onTypeIdChangedToUnsupported() { try { codec.onTypeIdChanged((short) 50); Assert.fail(); } catch (CodecException e) { assertThat(e.getMessage()).isEqualTo("Unknown IL-DCP packet type code: 50"); throw e; } }
protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new CodecException(format("Unknown IL-DCP packet type code: %s", typeId)); } }
AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new CodecException(format("Unknown IL-DCP packet type code: %s", typeId)); } } }
AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new CodecException(format("Unknown IL-DCP packet type code: %s", typeId)); } } AsnIldcpPacketCodec(); }
AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new CodecException(format("Unknown IL-DCP packet type code: %s", typeId)); } } AsnIldcpPacketCodec(); @Override T decode(); @Override void encode(T value); }
AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new CodecException(format("Unknown IL-DCP packet type code: %s", typeId)); } } AsnIldcpPacketCodec(); @Override T decode(); @Override void encode(T value);  }