class ChannelActionListener<
    Response extends TransportResponse, Request extends TransportRequest> implements ActionListener<Response> {

    private static final Logger LOGGER = LogManager.getLogger(ChannelActionListener.class);
    private final TransportChannel channel;
    private final Request request;
    private final String actionName;

    public ChannelActionListener(TransportChannel channel, String actionName, Request request) {
        this.channel = channel;
        this.request = request;
        this.actionName = actionName;
    }

    @Override
    public void onResponse(Response response) {
        try {
            channel.sendResponse(response);
        } catch (Exception e) {
            onFailure(e);
        }
    }

    @Override
    public void onFailure(Exception e) {<FILL_FUNCTION_BODY>}
}

        try {
            channel.sendResponse(e);
        } catch (Exception e1) {
            e1.addSuppressed(e);
            LOGGER.warn(() -> new ParameterizedMessage(
                "Failed to send error response for action [{}] and request [{}]", actionName, request), e1);
        }
    
<no_super_class>