/**
   * Executes the deserialization method.
   *
   * @param rbc the byte channel to read the serialized data from
   * @param bpb the buffer provider broker to request empty buffers from
   * @return the deserialized transfer envelope
   * @throws IOException thrown if an error occurs during the deserialization process
   * @throws NoBufferAvailableException thrown if the buffer provider broker could not provide an
   *     empty buffer
   */
  private TransferEnvelope executeDeserialization(
      final ReadableByteChannel rbc, final BufferProviderBroker bpb)
      throws IOException, NoBufferAvailableException {

    final DefaultDeserializer dd = new DefaultDeserializer(bpb);

    TransferEnvelope te = dd.getFullyDeserializedTransferEnvelope();
    while (te == null) {

      dd.read(rbc);
      te = dd.getFullyDeserializedTransferEnvelope();
    }

    assertEquals(SEQUENCE_NUMBER, te.getSequenceNumber());
    assertEquals(JOB_ID, te.getJobID());
    assertEquals(CHANNEL_ID, te.getSource());

    return te;
  }