Package org.tinyradius.test

Source Code of org.tinyradius.test.TestDictionary

/**
* $Id: TestDictionary.java,v 1.1 2005/09/06 16:38:41 wuttke Exp $
* Created on 06.09.2005
* @author mw
* @version $Revision: 1.1 $
*/
package org.tinyradius.test;

import java.io.FileInputStream;
import java.io.InputStream;

import org.tinyradius.attribute.IpAttribute;
import org.tinyradius.dictionary.Dictionary;
import org.tinyradius.dictionary.DictionaryParser;
import org.tinyradius.packet.AccessRequest;

/**
* Shows how to use TinyRadius with a custom dictionary
* loaded from a dictionary file.
* Requires a file "test.dictionary" in the current directory.
*/
public class TestDictionary {

  public static void main(String[] args)
  throws Exception {
    InputStream source = new FileInputStream("test.dictionary");
    Dictionary dictionary = DictionaryParser.parseDictionary(source);
    AccessRequest ar = new AccessRequest("UserName", "UserPassword");
    ar.setDictionary(dictionary);
    ar.addAttribute("WISPr-Location-ID", "LocationID");
    ar.addAttribute(new IpAttribute(8, 1234567));
    System.out.println(ar);
  }
 
}
TOP

Related Classes of org.tinyradius.test.TestDictionary

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.