@Test void shouldDecodeEmptyMessage() throws Exception { final RpcByteBufDecoder<EmptyMessage> decoder = encoding.createDecoder(EmptyMessage.class); final Optional<EmptyMessage> message = decoder.decodeOneMessage(Unpooled.wrappedBuffer(new byte[0])); assertThat(message).contains(EmptyMessage.EMPTY_MESSAGE); }
@Override public <T> RpcByteBufDecoder<T> createDecoder(Class<T> payloadType) { if (payloadType.equals(EmptyMessage.class)) { return getEmptyMessageDecoder(); } else { return new LengthPrefixedPayloadDecoder<>( payloadEncoders.getEncoder(payloadType), compressor); } }
LengthPrefixedEncoding implements RpcEncoding { @Override public <T> RpcByteBufDecoder<T> createDecoder(Class<T> payloadType) { if (payloadType.equals(EmptyMessage.class)) { return getEmptyMessageDecoder(); } else { return new LengthPrefixedPayloadDecoder<>( payloadEncoders.getEncoder(payloadType), compressor); } } }
LengthPrefixedEncoding implements RpcEncoding { @Override public <T> RpcByteBufDecoder<T> createDecoder(Class<T> payloadType) { if (payloadType.equals(EmptyMessage.class)) { return getEmptyMessageDecoder(); } else { return new LengthPrefixedPayloadDecoder<>( payloadEncoders.getEncoder(payloadType), compressor); } } LengthPrefixedEncoding(
      final String name, final RpcPayloadEncoders payloadEncoders, final Compressor compressor); }
LengthPrefixedEncoding implements RpcEncoding { @Override public <T> RpcByteBufDecoder<T> createDecoder(Class<T> payloadType) { if (payloadType.equals(EmptyMessage.class)) { return getEmptyMessageDecoder(); } else { return new LengthPrefixedPayloadDecoder<>( payloadEncoders.getEncoder(payloadType), compressor); } } LengthPrefixedEncoding(
      final String name, final RpcPayloadEncoders payloadEncoders, final Compressor compressor); @Override @SuppressWarnings("unchecked") Bytes encodePayload(final T message); @Override RpcByteBufDecoder<T> createDecoder(Class<T> payloadType); @Override String getName(); }
LengthPrefixedEncoding implements RpcEncoding { @Override public <T> RpcByteBufDecoder<T> createDecoder(Class<T> payloadType) { if (payloadType.equals(EmptyMessage.class)) { return getEmptyMessageDecoder(); } else { return new LengthPrefixedPayloadDecoder<>( payloadEncoders.getEncoder(payloadType), compressor); } } LengthPrefixedEncoding(
      final String name, final RpcPayloadEncoders payloadEncoders, final Compressor compressor); @Override @SuppressWarnings("unchecked") Bytes encodePayload(final T message); @Override RpcByteBufDecoder<T> createDecoder(Class<T> payloadType); @Override String getName();  }