package com.hmsoft.remote.rmi.transport;

import com.hmsoft.remote.rmi.exception.RemotingException;
import com.hmsoft.remote.rmi.handler.ChannelHandler;
import com.hmsoft.remote.rmi.handler.ExchangeHandler;
import com.hmsoft.remote.rmi.rpc.Client;
import com.hmsoft.remote.rmi.rpc.NettyClient;
import com.hmsoft.remote.rmi.rpc.NettyServer;

/**
 * 
 * @author zq
 *
 */
public class NettyTransporter {
	public static NettyTransporter instance = new NettyTransporter();
	
    private NettyTransporter() {
    }

    public static NettyTransporter getInstance() {
    	return instance;
    }
    
    public NettyServer bind(String url, ExchangeHandler handler) throws RemotingException {
        return new NettyServer(url, handler);
    }

    public Client connect(String url, ChannelHandler handler) throws RemotingException {
        return new NettyClient(url, handler);
    }
}
