public static <T> byte[] encodeToByteArray(Coder<T> coder, T value) throws CoderException {
    return encodeToByteArray(coder, value, Coder.Context.OUTER);
  }
@Test
  public void testClosingCoderFailsWhenEncodingToByteArrayInContext() throws Exception {
    expectedException.expect(UnsupportedOperationException.class);
    expectedException.expectMessage("Caller does not own the underlying");
    CoderUtils.encodeToByteArray(new ClosingCoder(), "test-value", Context.NESTED);
  }