@Before
  public void before() throws Exception {
    testObject = new Object();
    baos = new ByteArrayOutputStream();

    bais = new ByteArrayInputStream(new byte[0]);
    inputObject = new Object();

    Mockito.when(readOnlyCodec.deserializeObject(bais, IJsonTransferType.class))
        .thenReturn(inputObject);
  }
  @SuppressWarnings("unchecked")
  @BeforeClass
  public static void beforeClass() {
    writeOnlyCodec = Mockito.mock(ITransferCodec.class);
    Mockito.when(
            writeOnlyCodec.isSerilizationSupported(
                Mockito.any(Class.class), Mockito.any(ITransferType.class.getClass())))
        .thenReturn(false);
    Mockito.when(writeOnlyCodec.isSerilizationSupported(Object.class, IJsonTransferType.class))
        .thenReturn(true);
    Mockito.when(
            writeOnlyCodec.isDeserilizationSupported(
                Mockito.any(Class.class), Mockito.any(ITransferType.class.getClass())))
        .thenReturn(false);

    readOnlyCodec = Mockito.mock(ITransferCodec.class);
    Mockito.when(
            readOnlyCodec.isDeserilizationSupported(
                Mockito.any(Class.class), Mockito.any(ITransferType.class.getClass())))
        .thenReturn(false);
    Mockito.when(readOnlyCodec.isDeserilizationSupported(Object.class, IJsonTransferType.class))
        .thenReturn(true);
    Mockito.when(
            readOnlyCodec.isSerilizationSupported(
                Mockito.any(Class.class), Mockito.any(ITransferType.class.getClass())))
        .thenReturn(false);

    TransferCodecRegistry.instance().registerCodec(readOnlyCodec);
    TransferCodecRegistry.instance().registerCodec(writeOnlyCodec);
  }