/** Initialize all event listener and configure */ private void initializeListener() { /* * 1. Listen and handle Client Connection Close Notification Event */ FermatEventListener fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_CLOSE); fermatEventListener.setEventHandler(new ClientConnectionCloseNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 2 Listen and handle Client Connection Loose Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_CONNECTION_LOOSE); fermatEventListener.setEventHandler(new ClientConnectionLooseNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 3 Listen and handle Client Connection Success Reconnect Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.CLIENT_SUCCESS_RECONNECT); fermatEventListener.setEventHandler( new ClientSuccessfulReconnectNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 4 Listen and handle Complete Request List Component Registered Notification Event */ fermatEventListener = eventManager.getNewListener( P2pEventType.COMPLETE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION); fermatEventListener.setEventHandler( new CompleteComponentConnectionRequestNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 5 Listen and handle Complete Component Registration Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.COMPLETE_COMPONENT_REGISTRATION_NOTIFICATION); fermatEventListener.setEventHandler( new CompleteComponentRegistrationNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 6 Listen and handle Complete Request list */ fermatEventListener = eventManager.getNewListener( P2pEventType.COMPLETE_REQUEST_LIST_COMPONENT_REGISTERED_NOTIFICATION); fermatEventListener.setEventHandler( new CompleteRequestListComponentRegisteredNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 7 Listen and handle Complete Update Actor Profile Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.COMPLETE_UPDATE_ACTOR_NOTIFICATION); fermatEventListener.setEventHandler(new CompleteUpdateActorNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 8 Listen and handle failure component connection */ fermatEventListener = eventManager.getNewListener(P2pEventType.FAILURE_COMPONENT_CONNECTION_REQUEST_NOTIFICATION); fermatEventListener.setEventHandler( new FailureComponentConnectionRequestNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 9 Listen and handle VPN Connection Close Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.VPN_CONNECTION_CLOSE); fermatEventListener.setEventHandler(new VPNConnectionCloseNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 10 Listen and handle VPN Connection Loose Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.VPN_CONNECTION_LOOSE); fermatEventListener.setEventHandler(new VPNConnectionLooseNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); /* * 11 Listen and handle Register Server Request Notification Event */ fermatEventListener = eventManager.getNewListener(P2pEventType.REGISTER_SERVER_REQUEST_NOTIFICATION); fermatEventListener.setEventHandler(new RegisterServerRequestNotificationEventHandler(this)); eventManager.addListener(fermatEventListener); listenersAdded.add(fermatEventListener); }