Examples of NioSocketConnector


Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

    }

    public void testTCPWithSSL() throws Exception {
        useSSL = true;
        // Create a connector
        IoConnector connector = new NioSocketConnector();

        // Add an SSL filter to connector
        connector.getFilterChain().addLast("SSL", connectorSSLFilter);
        testConnector(connector);
    }
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        long timeout = configuration.getTimeout();
        List<IoFilter> filters = configuration.getFilters();

        address = new InetSocketAddress(configuration.getHost(), configuration.getPort());

        connector = new NioSocketConnector(
            new NioProcessor(this.getEndpoint().getCamelContext().getExecutorServiceManager().newDefaultThreadPool(this, "MinaSocketConnector")));

        // connector config
        connectorConfig = connector.getSessionConfig();
        connector.getFilterChain().addLast("threadPool",
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        }

        // Create the connector if needed
        if ( connector == null )
        {
            connector = new NioSocketConnector();
            localConnector = true;

            // Add the codec to the chain
            connector.getFilterChain().addLast( "ldapCodec", ldapProtocolFilter );
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

  public void connect() {
    m_packetGen = new PacketGenerator();
    /*
     * Connect via TCP to game server
     */
    NioSocketConnector connector = new NioSocketConnector();
    connector.getFilterChain().addLast("codec",
        new ProtocolCodecFilter(
            new TextLineCodecFactory(Charset.forName("US-ASCII"))));
    connector.setHandler(new TcpProtocolHandler(this));
    ConnectFuture cf = connector.connect(new InetSocketAddress(HOST, 7002));
    cf.addListener(new IoFutureListener() {
      public void operationComplete(IoFuture s) {
        try {
          if(s.getSession() != null && s.getSession().isConnected()) {
            m_packetGen.setTcpSession(s.getSession());
          } else {
            messageDialog("Connection timed out.\n"
                + "The server may be offline.\n"
                + "Contact an administrator for assistance.", getDisplay());
            HOST = "";
            m_packetGen = null;
          }
        }catch(RuntimeIoException e){
          messageDialog("Connection timed out.\n"
              + "The server may be offline.\n"
              + "Contact an administrator for assistance.", getDisplay());
          HOST = "";
          m_packetGen = null;
        }catch (Exception e) {
          e.printStackTrace();
          messageDialog("Connection timed out.\n"
              + "The server may be offline.\n"
              + "Contact an administrator for assistance.", getDisplay());
          HOST = "";
          m_packetGen = null;
        }
      }
    });
    /*
     * Connect via UDP to game server
     */
    NioDatagramConnector udp = new NioDatagramConnector();
    udp.getFilterChain().addLast("codec",
        new ProtocolCodecFilter(
            new TextLineCodecFactory(Charset.forName("US-ASCII"))));
    udp.setHandler(new UdpProtocolHandler(this));
    cf = udp.connect(new InetSocketAddress(HOST, 7005));
    cf.addListener(new IoFutureListener() {
      public void operationComplete(IoFuture s) {
        try {
          if(s.getSession().isConnected()) {
            m_packetGen.setUdpSession(s.getSession());
          } else {
            messageDialog("Connection timed out.\n"
                + "The server may be offline.\n"
                + "Contact an administrator for assistance.", getDisplay());
            HOST = "";
            m_packetGen = null;
          }
        }catch(RuntimeIoException e){
          messageDialog("Connection timed out.\n"
              + "The server may be offline.\n"
              + "Contact an administrator for assistance.", getDisplay());
          HOST = "";
          m_packetGen = null;
        } catch (Exception e) {
          e.printStackTrace();
          messageDialog("Connection timed out.\n"
              + "The server may be offline.\n"
              + "Contact an administrator for assistance.", getDisplay());
          HOST = "";
          m_packetGen = null;
        }
      }
    });
    /*
     * Connect via TCP to chat server
     */
    NioSocketConnector chat = new NioSocketConnector();
    chat.getFilterChain().addLast("codec",
        new ProtocolCodecFilter(
            new TextLineCodecFactory(Charset.forName("US-ASCII"))));
    chat.setHandler(new ChatProtocolHandler());
    ConnectFuture cf2 = connector.connect(new InetSocketAddress(CHATHOST, 7001));
    cf2.addListener(new IoFutureListener() {
      public void operationComplete(IoFuture s) {
        try {
          if(s.getSession() != null && s.getSession().isConnected()) {
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        }

        // Create the connector if needed
        if ( connector == null )
        {
            connector = new NioSocketConnector();
            localConnector = true;

            // Add the codec to the chain
            connector.getFilterChain().addLast( "ldapCodec", ldapProtocolFilter );
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        sessionFactory.setClient(this);
        connector.setHandler(sessionFactory);
    }

    protected NioSocketConnector createAcceptor() {
        return new NioSocketConnector(getNioWorkers());
    }
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        String originatorIpAddress = buffer.getString();
        int originatorPort = buffer.getInt();
        log.info("Receiving request for direct tcpip: hostToConnect={}, portToConnect={}, originatorIpAddress={}, originatorPort={}",
                new Object[] { hostToConnect, portToConnect, originatorIpAddress, originatorPort });
        connector = new NioSocketConnector();
        out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA);
        IoHandler handler = new IoHandlerAdapter() {
            @Override
            public void messageReceived(IoSession session, Object message) throws Exception {
                IoBuffer ioBuffer = (IoBuffer) message;
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

  public void connect() {
    if (client == null) {
      client = new MinaTaskClient(
        "org.drools.process.workitem.wsht.WSHumanTaskHandler",
                    new TaskClientHandler(SystemEventListenerFactory.getSystemEventListener()));
      NioSocketConnector connector = new NioSocketConnector();
      SocketAddress address = new InetSocketAddress(ipAddress, port);
      boolean connected = client.connect(connector, address);
      if (!connected) {
        throw new IllegalArgumentException(
          "Could not connect task client");
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

        this.connector.setHandler( this.handler );
        return connect();
    }

  public boolean connect(String address, int port) {
    this.connector = new NioSocketConnector();
        this.address = new InetSocketAddress( address, port );
        this.connector.setHandler( this.handler );
        return connect();
  }
View Full Code Here

Examples of org.apache.mina.transport.socket.nio.NioSocketConnector

            throw new IllegalStateException(
                    "Already connected. Disconnect first.");
        }

        if (this.connector==null) {
          this.connector = new NioSocketConnector();
        }
       
        if (this.address==null) {
          this.address = new InetSocketAddress( "127.0.0.1", 9123);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.