public static <T extends org.apache.thrift.TServiceClient> T createApplicationCatalogClient(String serverHost, int serverPort, Class<T> type) throws Exception{
try {
TTransport transport = new TSocket(serverHost, serverPort);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
TMultiplexedProtocol mp = new TMultiplexedProtocol(protocol, "AppCatalog");
return type.getConstructor(TProtocol.class).newInstance(mp);
} catch (TTransportException e) {
throw new AiravataClientConnectException("Unable to connect to the server at "+serverHost+":"+serverPort);
} catch (Exception e) {
throw new Exception("Invalid Airavata API Service "+type.getClass().getCanonicalName());