WebSessionContext “UnsupportedOperationException” exception

You’ll need to run this code in a main thread event. Have a look at this conversation.