Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package net.vnt.ussdapp; import com.leibict.ussd.USSD; import net.vnt.ussdapp.util.Context; import net.vnt.ussdapp.util.config.ContextProperties; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * * @author doclv */ public class USSDApp { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/context.xml" }); ContextProperties properties = (ContextProperties) Context.getInstance().getBean("ContextProperties"); try { if (USSD.initialize() == 0) { System.out.println("Error initializing"); return; } if (USSD.connect(properties.getProperty("ip.ussdgw"), properties.getInt("port.ussdgw")) == 0) { System.out.println("Error connecting"); return; } while (true) { Thread.sleep(1000); } } catch (InterruptedException ex) { ex.printStackTrace(); } } }