use of com.couchbase.client.core.cnc.events.io.SaslMechanismsListingFailedEvent in project couchbase-jvm-clients by couchbase.
the class SaslListMechanismsHandler method failConnection.
/**
* Helper method to fail the connection due to an unsuccessful sasl list mechs event.
*
* @param message the message that should be part of the error
* @param status the status code from the memcached response
* @param duration the duration how long it took overall
*/
private void failConnection(final String message, final short status, final Optional<Duration> duration) {
KeyValueIoErrorContext errorContext = new KeyValueIoErrorContext(MemcacheProtocol.decodeStatus(status), endpointContext, null);
ioContext.environment().eventBus().publish(new SaslMechanismsListingFailedEvent(duration.orElse(Duration.ZERO), errorContext, message));
interceptedConnectPromise.tryFailure(new AuthenticationFailureException(message, errorContext, null));
}
Aggregations