Refactor StateChangeListenerEndpoint.java