static MockRequest fromRequest(RequestOrResponse request) throws IOException {
      ByteBuffer buffer = ByteBuffer.allocate((int) request.sizeInBytes());
      request.writeTo(new ByteBufferChannel(buffer));
      request.release();
      buffer.flip();
      // read length (to bring it to a state where AmbryRequests can handle it).
      buffer.getLong();
      return new MockRequest(new ByteBufferDataInputStream(buffer));
    }
Constructs a {@link MockRequest} from {@code request}.
@param request the {@link RequestOrResponse} to construct the {@link MockRequest} for.
@return an instance of {@link MockRequest} that represents {@code request}.
@throws IOException
ambry-server/src/test/java/com/github/ambry/server/AmbryServerRequestsTest.java