package testRMI;

import java.net.Socket;
import java.io.ObjectInputStream;

public class ImportChannel {
	
	@SuppressWarnings("unchecked")
	public static <T> T imp(String host, int port) {
		T t = null;
		try {
			Socket s = new Socket(host, port);
			ObjectInputStream i = new ObjectInputStream(s.getInputStream());
			t = (T) i.readObject();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return t;
	}
}
