static Optional<String> globalResponseError(Optional<ClientResponse> response) {
        if (!response.isPresent()) {
            return Optional.of("Timeout");
        }
        if (response.get().authenticationException() != null) {
            return Optional.of("AuthenticationException");
        }
        if (response.get().wasTimedOut()) {
            return Optional.of("Disonnected[Timeout]");
        }
        if (response.get().wasDisconnected()) {
            return Optional.of("Disconnected");
        }
        if (response.get().versionMismatch() != null) {
            return Optional.of("UnsupportedVersionException");
        }
        if (response.get().responseBody() == null) {
            return Optional.of("EmptyResponse");
        }
        if (!(response.get().responseBody() instanceof AssignReplicasToDirsResponse)) {
            return Optional.of("ClassCastException");
        }
        AssignReplicasToDirsResponseData data = ((AssignReplicasToDirsResponse)
            response.get().responseBody()).data();
        Errors error = Errors.forCode(data.errorCode());
        if (error != Errors.NONE) {
            return Optional.of("Response-level error: " + error.name());
        }
        return Optional.empty();
    }
@Test
    public void testNoGlobalResponseError() {
        assertEquals(Optional.empty(),
            AssignmentsManager.globalResponseError(Optional.of(
                new ClientResponse(null, null, "", 0, 0, false, null,
                    null, new AssignReplicasToDirsResponse(
                        new AssignReplicasToDirsResponseData())))));
    }