List of usage examples for org.apache.http.nio.reactor IOSession getRemoteAddress
SocketAddress getRemoteAddress();
From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java
@Override public void inputReady(IOSession session) { InetSocketAddress isa = (InetSocketAddress) session.getRemoteAddress(); MLLPSourceHandler handler = handlers.get(isa.getPort()); handler.inputReady(session);//from w w w . j a va2 s . c o m }
From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java
@Override public void outputReady(IOSession session) { InetSocketAddress isa = (InetSocketAddress) session.getRemoteAddress(); MLLPSourceHandler handler = handlers.get(isa.getPort()); handler.outputReady(session);//w w w. j a v a2s. c o m }
From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java
@Override public void timeout(IOSession session) { InetSocketAddress isa = (InetSocketAddress) session.getRemoteAddress(); InetSocketAddress localIsa = (InetSocketAddress) session.getLocalAddress(); MLLPSourceHandler handler = handlers.get(isa.getPort()); handler.timeout(session);//from www .j a v a2 s. com handlers.remove(handler); endpointSessions.remove(localIsa.getPort() + "-" + isa.getPort()); }
From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java
@Override public void disconnected(IOSession session) { InetSocketAddress isa = (InetSocketAddress) session.getRemoteAddress(); InetSocketAddress localIsa = (InetSocketAddress) session.getLocalAddress(); if (isa == null) { return;/* w ww. j a v a2s . c o m*/ } MLLPSourceHandler handler = handlers.get(isa.getPort()); handler.disconnected(session); handlers.remove(handler); endpointSessions.remove(localIsa.getPort() + "-" + isa.getPort()); }
From source file:org.wso2.carbon.inbound.endpoint.protocol.hl7.core.MultiIOHandler.java
@Override public void connected(IOSession session) { InetSocketAddress remoteIsa = (InetSocketAddress) session.getRemoteAddress(); InetSocketAddress localIsa = (InetSocketAddress) session.getLocalAddress(); MLLPSourceHandler handler = new MLLPSourceHandler(processorMap.get(localIsa.getPort())); handlers.put(remoteIsa.getPort(), handler); endpointSessions.put(localIsa.getPort() + "-" + remoteIsa.getPort(), session); handler.connected(session);/*from www. ja v a 2 s . com*/ }
From source file:org.siddhiesb.transport.http.conn.ClientConnFactory.java
private SSLContext getSSLContext(final IOSession iosession) { InetSocketAddress address = (InetSocketAddress) iosession.getRemoteAddress(); String host = address.getHostName() + ":" + address.getPort(); SSLContext customContext = null; if (sslByHostMap != null) { // See if there's a custom SSL profile configured for this server customContext = sslByHostMap.get(host); }/*from w w w.j ava 2 s.c om*/ if (customContext != null) { return customContext; } else { return ssl != null ? ssl.getContext() : null; } }
From source file:com.ok2c.lightmtp.impl.protocol.ServiceReadyCodec.java
@Override public void reset(final IOSession iosession, final ServerState sessionState) throws IOException, SMTPProtocolException { this.writer.reset(); InetSocketAddress socketAddress = (InetSocketAddress) iosession.getRemoteAddress(); InetAddress clientAddress = socketAddress.getAddress(); if (this.addressValidator != null) { if (!this.addressValidator.validateAddress(clientAddress)) { sessionState.terminated();// w w w. j a v a2s.co m iosession.close(); return; } } sessionState.setClientAddress(clientAddress); this.pendingReply = new SMTPReply(SMTPCodes.SERVICE_READY, null, sessionState.getServerId() + " service ready"); this.completed = false; iosession.setEventMask(SelectionKey.OP_WRITE); }
From source file:org.apache.synapse.transport.nhttp.HttpCoreNIOSSLSender.java
private SSLSetupHandler createSSLSetupHandler(final String hostnameVerifier, final CertificateVerificationConfig cvConfig) throws AxisFault { return new SSLSetupHandler() { public void initalize(SSLEngine sslengine) { }/*from ww w . j a v a 2s. c o m*/ public void verify(IOSession ioSession, SSLSession session) throws SSLException { SocketAddress remoteAddress = ioSession.getRemoteAddress(); String address; if (remoteAddress instanceof InetSocketAddress) { address = ((InetSocketAddress) remoteAddress).getHostName(); } else { address = remoteAddress.toString(); } boolean valid = false; //Do HostName verification. if (hostnameVerifier != null) { if ("Strict".equals(hostnameVerifier)) { valid = HostnameVerifier.STRICT.verify(address, session); } else if ("AllowAll".equals(hostnameVerifier)) { valid = HostnameVerifier.ALLOW_ALL.verify(address, session); } else if ("DefaultAndLocalhost".equals(hostnameVerifier)) { valid = HostnameVerifier.DEFAULT_AND_LOCALHOST.verify(address, session); } } else { valid = HostnameVerifier.DEFAULT.verify(address, session); } if (!valid) { throw new SSLException("Host name verification failed for host : " + address); } if (cvConfig != null) { try { ocspCrl.verifyRevocationStatus(session.getPeerCertificateChain(), cvConfig.getCacheSize(), cvConfig.getCacheDuration()); } catch (CertificateVerificationException e) { throw new SSLException("Certificate chain validation failed for host : " + address, e); } } } }; }