1.确定服务器地址:
//确定服务器器地址,这里为本机地址
InetAddress inetAddress = null;
try {
inetAddress = InetAddress.getLocalHost();
}catch (UnknownHostException e){
...
}
2.开启服务器
//新建Server对象,并设置好监听的端口
RadiusServer server = new RadiusServer();
server.setListenAddress(inetAddress);
server.setAcctPort(8071);
server.setAuthPort(8072);
//开启服务
server.start(true, true);
2.启动客户端
//新建client对象
RadiusClient client = new RadiusClient(inetAddress.getHostAddress(), "00000000");
//设置发送到目的服务器的端口号
client.setAcctPort(8071);
client.setAuthPort(8072);
//申请认证
client.authenticate(userName, Password);