some logic is repeated in the if-elseif-else. Can be simplified as

```
if (!isShutdown.get() && connection.isUsable()) {
    ...
} else {
   ...
}
```