Search in sources :

Example 1 with IoHandler

use of org.apache.mina.common.IoHandler in project camel by apache.

the class MinaProducer method openConnection.

private void openConnection() {
    SocketAddress address = getEndpoint().getAddress();
    connector = getEndpoint().getConnector();
    if (LOG.isDebugEnabled()) {
        LOG.debug("Creating connector to address: {} using connector: {} timeout: {} millis.", new Object[] { address, connector, timeout });
    }
    IoHandler ioHandler = new ResponseHandler(getEndpoint());
    // connect and wait until the connection is established
    ConnectFuture future = connector.connect(address, ioHandler, getEndpoint().getConnectorConfig());
    future.join();
    session = future.getSession();
}
Also used : ConnectFuture(org.apache.mina.common.ConnectFuture) SocketAddress(java.net.SocketAddress) IoHandler(org.apache.mina.common.IoHandler)

Example 2 with IoHandler

use of org.apache.mina.common.IoHandler in project camel by apache.

the class MinaConsumer method doStart.

@Override
protected void doStart() throws Exception {
    super.doStart();
    LOG.info("Binding to server address: {} using acceptor: {}", address, acceptor);
    IoHandler handler = new ReceiveHandler();
    if (protocol.equals("tcp") && clientMode) {
        ConnectFuture future = connector.connect(address, handler, getEndpoint().getConnectorConfig());
        future.join();
        session = future.getSession();
    } else {
        acceptor.bind(address, handler, getEndpoint().getAcceptorConfig());
    }
}
Also used : ConnectFuture(org.apache.mina.common.ConnectFuture) IoHandler(org.apache.mina.common.IoHandler)

Aggregations

ConnectFuture (org.apache.mina.common.ConnectFuture)2 IoHandler (org.apache.mina.common.IoHandler)2 SocketAddress (java.net.SocketAddress)1