Android Open Source - mobile-chat Mina Server






From Project

Back to project page mobile-chat.

License

The source code is released under:

GNU General Public License

If you think the Android project mobile-chat listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package br.com.etyllica.sonat.adapter.mina.server;
//from w  w w.ja va 2s. c om
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.charset.Charset;

import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;

import br.com.etyllica.sonat.server.Server;
import br.com.etyllica.sonat.server.ServerImpl;

public class MinaServer extends ServerImpl implements Server {
   
  public MinaServer(int port) {
    super(port);  
  }

  public void init() throws IOException {
    
    IoAcceptor acceptor = new NioSocketAcceptor();

    acceptor.getFilterChain().addLast("logger", new LoggingFilter());
    acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8"))));

    acceptor.setHandler(new MinaChatServerHandler());
    acceptor.getSessionConfig().setReadBufferSize(2048);
    acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 600);
    
    acceptor.bind(new InetSocketAddress(port));
  }
  
}




Java Source Code List

br.com.etyllica.mobile.gui.HorizontalRule.java
br.com.etyllica.sonat.adapter.mina.client.MinaChatClientHandler.java
br.com.etyllica.sonat.adapter.mina.client.MinaClient.java
br.com.etyllica.sonat.adapter.mina.server.MinaChatServerHandler.java
br.com.etyllica.sonat.adapter.mina.server.MinaServer.java
br.com.etyllica.sonat.chat.ChatServerHandler.java
br.com.etyllica.sonat.client.ClientImpl.java
br.com.etyllica.sonat.client.ClientListener.java
br.com.etyllica.sonat.client.Client.java
br.com.etyllica.sonat.server.ServerHandler.java
br.com.etyllica.sonat.server.ServerImpl.java
br.com.etyllica.sonat.server.Server.java
br.unirio.livechat.ChatActivity.java
br.unirio.livechat.LoginActivity.java
br.unirio.livechat.ServerActivity.java