List of usage examples for org.springframework.integration.ip.tcp.connection TcpConnectionEvent getConnectionId
public String getConnectionId()
From source file:ru.jts_dev.authserver.service.AuthSessionService.java
@Order(Ordered.HIGHEST_PRECEDENCE) @EventListener/*from w ww .ja va 2s. co m*/ private void tcpConnectionEventListener(TcpConnectionEvent event) { sessions.put(event.getConnectionId(), createSession(event.getConnectionId())); }
From source file:ru.jts_dev.gameserver.service.GameSessionService.java
@Order(Ordered.HIGHEST_PRECEDENCE) @EventListener// www . jav a2 s . c o m private void tcpConnectionEventListener(TcpConnectionEvent event) { sessions.put(event.getConnectionId(), createSession((TcpConnection) event.getSource())); }
From source file:ru.jts_dev.authserver.config.AuthIntegrationConfig.java
/** * Event listener for {@link TcpConnectionEvent}. * Event receives when new connection accepted. * * @param event - event instance// www . ja v a 2 s.c o m */ @EventListener public void authTcpConnectionEventListener(TcpConnectionEvent event) { String connectionId = event.getConnectionId(); AuthSession gameSession = authSessionService.getSessionBy(connectionId); byte[] scrambledModulus = scrambleModulus( ((RSAPublicKey) gameSession.getRsaKeyPair().getPublic()).getModulus()); byte[] blowfishKey = gameSession.getBlowfishKey(); OutgoingMessageWrapper msg = new Init(gameSession.getSessionId(), scrambledModulus, blowfishKey); msg.getHeaders().put(IpHeaders.CONNECTION_ID, event.getConnectionId()); packetChannel().send(msg); }
From source file:org.bitcoinrt.server.ConnectionBroker.java
@Override public void onApplicationEvent(TcpConnectionEvent event) { final EventType eventType = event.getType(); if (TcpConnectionEventType.OPEN.equals(eventType)) { } else if (TcpConnectionEventType.CLOSE.equals(eventType)) { logger.info("TCP Event: CLOSED - Removing client: {}", event.getConnectionId()); clients.remove(event.getConnectionId()); } else if (TcpConnectionEventType.EXCEPTION.equals(eventType)) { logger.warn("EXCEPTION Event - Removing client: {}", event.getConnectionId()); clients.remove(event.getConnectionId()); } else if (WebSocketEventType.HANDSHAKE_COMPLETE.equals(eventType)) { logger.info("HANDSHAKE_COMPLETE - Adding client: {}", event.getConnectionId()); clients.put(event.getConnectionId(), new AtomicInteger()); } else if (WebSocketEventType.WEBSOCKET_CLOSED.equals(eventType)) { logger.info("WEBSOCKET_CLOSED - Removing client: {}", event.getConnectionId()); clients.remove(event.getConnectionId()); } else {//from ww w . ja v a 2 s .c om throw new IllegalArgumentException(String.format("EventType '%s' is not supported.", eventType)); } }