### Question:
ProtoLiteUtils { public static <T extends MessageLite> Metadata.BinaryMarshaller<T> metadataMarshaller( T defaultInstance) { return new MetadataMarshaller<T>(defaultInstance); } private  ProtoLiteUtils(); @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1787") static void setExtensionRegistry(ExtensionRegistryLite newRegistry); static Marshaller<T> marshaller(T defaultInstance); static Metadata.BinaryMarshaller<T> metadataMarshaller(
      T defaultInstance);  }### Answer:
@Test public void metadataMarshaller_roundtrip() { Metadata.BinaryMarshaller<Type> metadataMarshaller = ProtoLiteUtils.metadataMarshaller(Type.getDefaultInstance()); assertEquals(proto, metadataMarshaller.parseBytes(metadataMarshaller.toBytes(proto))); }
@Test public void metadataMarshaller_invalid() { Metadata.BinaryMarshaller<Type> metadataMarshaller = ProtoLiteUtils.metadataMarshaller(Type.getDefaultInstance()); try { metadataMarshaller.parseBytes(new byte[] {-127}); fail("Expected exception"); } catch (IllegalArgumentException ex) { assertNotNull(((InvalidProtocolBufferException) ex.getCause()).getUnfinishedMessage()); } }