private HttpResponseStatus getExpectedHttpResponseStatus(RestServiceErrorCode code) {
    switch (code) {
      case RequestTooLarge:
        return HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE;
      case Conflict:
        return HttpResponseStatus.CONFLICT;
      case Deleted:
        return HttpResponseStatus.GONE;
      case NotFound:
        return HttpResponseStatus.NOT_FOUND;
      case BadRequest:
      case InvalidArgs:
      case InvalidAccount:
      case InvalidContainer:
      case InvalidRequestState:
      case MalformedRequest:
      case MissingArgs:
      case UnsupportedHttpMethod:
      case UnsupportedEncoding:
        return HttpResponseStatus.BAD_REQUEST;
      case ResourceDirty:
      case AccessDenied:
        return HttpResponseStatus.FORBIDDEN;
      case Unauthorized:
        return HttpResponseStatus.UNAUTHORIZED;
      case ResourceScanInProgress:
        return HttpResponseStatus.PROXY_AUTHENTICATION_REQUIRED;
      case RangeNotSatisfiable:
        return HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
      case ServiceUnavailable:
        return HttpResponseStatus.SERVICE_UNAVAILABLE;
      case TooManyRequests:
        return HttpResponseStatus.TOO_MANY_REQUESTS;
      case InsufficientCapacity:
        return HttpResponseStatus.INSUFFICIENT_STORAGE;
      case IdConverterServiceError:
      case InternalServerError:
      case RequestChannelClosed:
      case RequestResponseQueuingFailure:
      case UnsupportedRestMethod:
        return HttpResponseStatus.INTERNAL_SERVER_ERROR;
      case PreconditionFailed:
        return HttpResponseStatus.PRECONDITION_FAILED;
      case NotAllowed:
        return HttpResponseStatus.METHOD_NOT_ALLOWED;
      default:
        throw new IllegalArgumentException("Unrecognized RestServiceErrorCode - " + code);
    }
  }
@param code the {@link RestServiceErrorCode} whose {@link HttpResponseStatus} equivalent is required.
@return the {@link HttpResponseStatus} equivalent of {@code code}.
ambry-rest/src/test/java/com/github/ambry/rest/NettyResponseChannelTest.java