// Path: monica-framework/src/main/java/monica/framework/Client.java
// public interface Client {
// 	public void start(String ip, int port) throws Exception;
//     public  boolean isStarted();
// }
// 
// Path: monica-registry/src/main/java/monica/registry/context/RegistryContext.java
// public class RegistryContext {
// 	// caheKey: curatorClient providers server usefulProviders
// 	public static ConcurrentHashMap<String, Object> clientCache = new ConcurrentHashMap<String, Object>();
// }


import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import monica.framework.Client;
import monica.registry.context.RegistryContext;

package monica.starter.client;


/**
 * 
 * @author lucy@polarcoral.com
 *
 *         2017-08-29
 */
public class ClientFactory {
	private final String SERVER_IP_CACHE = "server_ip";
	private final String SERVER_PORT_CACHE = "server_port";
	private String protocolString = "socket";
	private static ClientFactory factory = new ClientFactory();
	private String ip = (String) RegistryContext.clientCache.get(SERVER_IP_CACHE);
	private int port = Integer.valueOf((String) RegistryContext.clientCache.get(SERVER_PORT_CACHE));

	public static ClientFactory newFactory() {
		if (null != factory) {
			return factory;
		}
		return new ClientFactory();
	}


// Path: monica-framework/src/main/java/monica/framework/Client.java
// public interface Client {
// 	public void start(String ip, int port) throws Exception;
//     public  boolean isStarted();
// }
// 
// Path: monica-registry/src/main/java/monica/registry/context/RegistryContext.java
// public class RegistryContext {
// 	// caheKey: curatorClient providers server usefulProviders
// 	public static ConcurrentHashMap<String, Object> clientCache = new ConcurrentHashMap<String, Object>();
// }


// Path: monica-starter/src/main/java/monica/starter/client/ClientFactory.java
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;
import monica.framework.Client;
import monica.registry.context.RegistryContext;

package monica.starter.client;


/**
 * 
 * @author lucy@polarcoral.com
 *
 *         2017-08-29
 */
public class ClientFactory {
	private final String SERVER_IP_CACHE = "server_ip";
	private final String SERVER_PORT_CACHE = "server_port";
	private String protocolString = "socket";
	private static ClientFactory factory = new ClientFactory();
	private String ip = (String) RegistryContext.clientCache.get(SERVER_IP_CACHE);
	private int port = Integer.valueOf((String) RegistryContext.clientCache.get(SERVER_PORT_CACHE));

	public static ClientFactory newFactory() {
		if (null != factory) {
			return factory;
		}
		return new ClientFactory();
	}


	public Client getConsumerClient()
