Minor: prefer logging using format strings like:
```java
logger.debug("too many 401s - giving up after: %s", count.intValue());
```
This way, if the log level is not enabled, the string concatenation does not happen (and you save the underlying StringBuilder generated stuff).