### Question:
PingResponseDataDecoder implements EntityDecoder<ByteBuf, Integer> { @Override public Integer decode(ByteBuf source) { int size = source.readableBytes(); if (size == 1) { return (int) source.readByte(); } if (size >= 4) { return source.readInt(); } return -1; }  @Override Integer decode(ByteBuf source);  }### Answer:
@Test public void testDecodePingResponseData() { ByteBuf buf = Unpooled.buffer(); PingResponseDataDecoder decoder = new PingResponseDataDecoder(); int big = Integer.MAX_VALUE; buf.writeInt(big); assertThat(decoder.decode(buf)).isEqualTo(big); byte small = 12; buf.writeByte(small); assertThat(decoder.decode(buf)).isEqualTo(small); buf.release(); }