()
| 168 | } |
| 169 | |
| 170 | @GuardedBy("this") |
| 171 | private final boolean canSend() { |
| 172 | switch (outboundState) { |
| 173 | case INITIAL: |
| 174 | if (!prefixReady) { |
| 175 | return false; |
| 176 | } |
| 177 | break; |
| 178 | case PREFIX_SENT: |
| 179 | // We can only send something if we have messages or the suffix. |
| 180 | // Note that if we have the suffix but no messages in this state, it means we've been closed |
| 181 | // early. |
| 182 | if (!messageAvailable() && !suffixReady) { |
| 183 | return false; |
| 184 | } |
| 185 | break; |
| 186 | case ALL_MESSAGES_SENT: |
| 187 | if (!suffixReady) { |
| 188 | return false; |
| 189 | } |
| 190 | break; |
| 191 | default: |
| 192 | return false; |
| 193 | } |
| 194 | return isReady(); |
| 195 | } |
| 196 | |
| 197 | final boolean isReady() { |
| 198 | return transport.isReady(); |
no test coverage detected