// window resize write would try to write the message on an already locked channelSession,
// while the pending write was in progress from the write callback
synchronized (asyncInLock) {
+ final var cause = future.getException();
if (LOG.isTraceEnabled()) {
- LOG.trace(
- "Ssh write request finished on channel: {} with result: {}: and ex:{}, message: {}",
- ctx.channel(), future.isWritten(), future.getException(), byteBufToString(byteBufMsg));
+ LOG.trace("Ssh write request finished on channel: {} with ex: {}, message: {}", ctx.channel(),
+ cause, byteBufToString(byteBufMsg));
}
// Notify success or failure
- if (future.isWritten()) {
- promise.setSuccess();
- } else {
+ if (cause != null) {
LOG.warn("Ssh write request failed on channel: {} for message: {}", ctx.channel(),
- byteBufToString(byteBufMsg), future.getException());
- promise.setFailure(future.getException());
+ byteBufToString(byteBufMsg), cause);
+ promise.setFailure(cause);
+ } else {
+ promise.setSuccess();
}
//rescheduling message from queue after successfully sent
Futures.addCallback(stubAddListener(ioWriteFuture), new SuccessFutureListener<IoWriteFuture>() {
@Override
public void onSuccess(final SshFutureListener<IoWriteFuture> result) {
- doReturn(false).when(ioWriteFuture).isWritten();
doReturn(new IllegalStateException()).when(ioWriteFuture).getException();
result.operationComplete(ioWriteFuture);
}
private static IoOutputStream getMockedIoOutputStream() throws IOException {
final IoOutputStream mock = mock(IoOutputStream.class);
final IoWriteFuture ioWriteFuture = mock(IoWriteFuture.class);
- doReturn(true).when(ioWriteFuture).isWritten();
+ doReturn(null).when(ioWriteFuture).getException();
Futures.addCallback(stubAddListener(ioWriteFuture), new SuccessFutureListener<IoWriteFuture>() {
@Override