issue #8934 sovled

runtime exception will be thrown when a anoymous class is provided to establish_connection.
also updated the corresponding test cases.