### Question:
EnvoyPropagator implements Propagator { @Override public <C> SpanContext extract(C carrier) { if (!(carrier instanceof BinaryExtract)) { return null; } ByteBuffer byteBuff = ((BinaryExtract) carrier).extractionBuffer(); if (byteBuff == null || !byteBuff.hasRemaining()) { return null; } BasicTracerCarrier basicCarrier = null; try { basicCarrier = BinaryCarrier.parseFrom(byteBuff).getBasicCtx(); } catch (InvalidProtocolBufferException e) { return null; } Map<String, String> baggage = new HashMap<>(); for (Map.Entry<String, String> entry: basicCarrier.getBaggageItemsMap().entrySet()) { baggage.put(entry.getKey(), entry.getValue()); } return new SpanContext(basicCarrier.getTraceId(), basicCarrier.getSpanId(), baggage); }  void inject(SpanContext spanContext, C carrier); @Override SpanContext extract(C carrier);  }### Answer:
@Test public void testExtractEmpty() { ByteBuffer emptyBuff = ByteBuffer.wrap(new byte[0]); SpanContext result = propagator.extract(BinaryAdapters.injectionCarrier(emptyBuff)); assertNull(result); }
@Test public void testExtractInvalid() { ByteBuffer invalidBuff = ByteBuffer.wrap(new byte[] { 1, 7, 13 }); SpanContext result = propagator.extract(BinaryAdapters.injectionCarrier(invalidBuff)); assertNull(result); }