public void setWriteTimeout(int writeTimeout) {
    this.writeTimeout = writeTimeout;
  }
@Test
  public void testErrorCodeForbidden() throws IOException {
    MockLowLevelHttpResponse[] responses =
        createMockResponseWithStatusCode(
            403, // Non-retryable error.
            200); // Shouldn't happen.

    when(mockLowLevelRequest.execute()).thenReturn(responses[0], responses[1]);

    try {
      Storage.Buckets.Get result = storage.buckets().get("test");
      HttpResponse response = result.executeUnparsed();
      assertNotNull(response);
    } catch (HttpResponseException e) {
      assertThat(e.getMessage(), Matchers.containsString("403"));
    }

    verify(mockHttpResponseInterceptor).interceptResponse(any(HttpResponse.class));
    verify(mockLowLevelRequest, atLeastOnce()).addHeader(anyString(), anyString());
    verify(mockLowLevelRequest).setTimeout(anyInt(), anyInt());
    verify(mockLowLevelRequest).setWriteTimeout(anyInt());
    verify(mockLowLevelRequest).execute();
    verify(responses[0], atLeastOnce()).getStatusCode();
    verify(responses[1], never()).getStatusCode();
    expectedLogs.verifyWarn("Request failed with code 403");
  }