/**
   * Tests the deserialization process of a {@link TransferEnvelope} with a buffer and interruptions
   * of the byte stream.
   */
  @Test
  public void testDeserializationWithBufferAndInterruptions() {

    try {

      final ReadableByteChannel rbc = createByteChannel(new int[] {3, 7, 24, 52}, 10);

      final TestBufferProviderBroker tbpb = new TestBufferProviderBroker(new TestBufferProvider(1));

      final TransferEnvelope te = executeDeserialization(rbc, tbpb);

      assertNotNull(te.getBuffer());
      assertEquals(10, te.getBuffer().size());

    } catch (IOException ioe) {
      fail(StringUtils.stringifyException(ioe));
    } catch (NoBufferAvailableException nbae) {
      fail(StringUtils.stringifyException(nbae));
    }
  }