Short answer: An internal library system not accessible by users of the library. Library users should use the close/fail handlers instead.
Details:
A connection has an internal state machine that is started via connection::start_accept (server connections) or connection::connect (client connections). Once either of these methods is called the state machine will proceed until the connection ends naturally or in an error. The termination state is the final state before the connection is considered closed and ready to be deallocated. The terminate handler is called during the termination phase. It’s purpose is to provide a way for an endpoint to be called back by a connection before it gets deallocated for any last minute cleanup. It is only used internally and cannot be triggered or set by programs that use the library. The reason it exists is that endpoints and connections are loosely coupled enough that connections do not retain a pointer to the endpoint that created them and endpoints do not retain pointers to their own outstanding connections.
Presently no endpoint implementations require the use of a termination handler so no termination handler is ever set or called. This has not and may not always be the case. Certain types of optimizations (for example a message buffer pool shared with all connections of one endpoint) require more communication between endpoints and connections. The termination handler is present to allow that sort of communication without requiring tight coupling for use cases that don’t need it.