After wait_timeout expires, server sends TCP RST to all TCP connections. Then JDBC tries to create another TCP connection, which seems successful, but for some reason JDBC closes this new TCP connection immediately.
I use Maven artifact
Then MariaDbPoolDataSource.getConnection() throws
java.sql.SQLNonTransientConnectionException: No connection available within the specified time (option 'connectTimeout': 30,000 ms)
What is strange - When I step through in debugger, then it works.
Set up wait_timeout=60 in my.cnf .
Run attached TcpRstMain2.java .
See attached Wireshark.