@Test
  public void adminRequestResponseTest() throws IOException {
    for (AdminRequestOrResponseType type : AdminRequestOrResponseType.values()) {
      PartitionId id = clusterMap.getWritablePartitionIds(MockClusterMap.DEFAULT_PARTITION_CLASS).get(0);
      // with a valid partition id
      AdminRequest adminRequest = new AdminRequest(type, id, correlationId, clientId);
      DataInputStream requestStream = serAndPrepForRead(adminRequest);
      MockRequest mockRequest = new MockRequest(requestStream);
      // 1. Verify request is decoded correctly
      RequestOrResponse request = requestResponseHelper.getDecodedRequest(mockRequest);
      assertEquals("Mismatch in request type", request.getRequestType(), RequestOrResponseType.AdminRequest);
      // 2. Verify response is formed correctly
      Response response = requestResponseHelper.createErrorResponse(request, ServerErrorCode.RetryAfterBackoff);
      assertEquals("Mismatch in response type", response.getRequestType(), RequestOrResponseType.AdminResponse);
      assertEquals("Mismatch in response correlation id", response.getCorrelationId(), correlationId);
      assertEquals("Mismatch in response client id", response.getClientId(), clientId);
      assertEquals("Mismatch in error code", response.getError(), ServerErrorCode.RetryAfterBackoff);
      request.release();
      response.release();
    }
  }
Test for undelete request and response.
@throws IOException
ambry-network/src/test/java/com/github/ambry/network/ServerRequestResponseHelperTest.java