ProtoUtils { @Deprecated public static <T extends MessageLite> Marshaller<T> marshaller(final T defaultInstance) { return ProtoLiteUtils.marshaller(defaultInstance); } private  ProtoUtils(); @Deprecated static Marshaller<T> marshaller(final T defaultInstance); static Marshaller<T> marshaller(final T defaultInstance); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1786") static Marshaller<T> jsonMarshaller(final T defaultInstance); static Metadata.Key<T> keyForProto(T instance);  }
@Test public void testRoundtrip() throws Exception { Marshaller<Type> marshaller = ProtoUtils.marshaller(Type.getDefaultInstance()); InputStream is = marshaller.stream(proto); is = new ByteArrayInputStream(ByteStreams.toByteArray(is)); assertEquals(proto, marshaller.parse(is)); }
@Test @Deprecated public void testRoundtripLite() throws Exception { Marshaller<MessageLite> marshaller = ProtoUtils.marshaller((MessageLite) Type.getDefaultInstance()); InputStream is = marshaller.stream(proto); is = new ByteArrayInputStream(ByteStreams.toByteArray(is)); assertEquals(proto, marshaller.parse(is)); }