NPE when attempting to cancel timeoutFuture as result of failure caused by SSL handshake failure

Description

If channel.writeAndFlush fails in ChannelHandlerRequest.send, onFailure is invoked, an NPE is thrown here because writeListener is not registered at this point so timeoutFuture has not been assigned.

This can happen when using SSL for example. The following stack trace is produced when running DefaultSslEngineFactoryWithClienAuthIT#should_not_connection_with_ssl_using_client_auth_if_keystore_not-set:

In any case the user still gets a AllNodesFailedException, but would be good to handle this more cleanly. Fix might be as simple as null checking timeoutFuture.

Environment

None

Pull Requests

None
Fixed

Assignee

Unassigned

Reporter

Andy Tolbert

Labels

None

PM Priority

None

Reproduced in

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Priority

Minor
Configure