src/main/java/org/tinyradius/proxy/RadiusProxy.java
protected void proxyPacket(RadiusPacket packet, RadiusProxyConnection proxyConnection)
        throws IOException {
        synchronized (RadiusProxy.class) {
            // add Proxy-State attribute
            proxyIndex++;
            String proxyIndexStr = Integer.toString(proxyIndex);
            packet.addAttribute(new RadiusAttribute(33, proxyIndexStr.getBytes()));

            // store RadiusProxyConnection object
            proxyConnections.put(proxyIndexStr, proxyConnection);
        }

        // get server address
        InetAddress serverAddress = proxyConnection.getRadiusServer().getEndpointAddress().getAddress();
        int serverPort = proxyConnection.getRadiusServer().getEndpointAddress().getPort();
        String serverSecret = proxyConnection.getRadiusServer().getSharedSecret();

        // save request authenticator (will be calculated new)
        byte[] auth = packet.getAuthenticator();

        // encode new packet (with new authenticator)
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        packet.encodeRequestPacket(bos, serverSecret);
        byte[] data = bos.toByteArray();
        DatagramPacket datagram = new DatagramPacket(data, data.length, serverAddress, serverPort);

        // restore original authenticator
        packet.setAuthenticator(auth);

        // send packet
        DatagramSocket proxySocket = getProxySocket();
        proxySocket.send(datagram);
    }
/**
     * Proxies the given packet to the server given in the proxy connection.
     * Stores the proxy connection object in the cache with a key that
     * is added to the packet in the "Proxy-State" attribute.
     *
     * @param packet          the packet to proxy
     * @param proxyConnection the RadiusProxyConnection for this packet
     * @throws IOException
     */
Proxies the given packet to the server given in the proxy connection.
Stores the proxy connection object in the cache with a key that
is added to the packet in the "Proxy-State" attribute.

@param packet          the packet to proxy
@param proxyConnection the RadiusProxyConnection for this packet
@throws IOException
Proxies the given packet to the server given in the proxy connection . Stores the proxy connection object in the cache with a key that is added to the packet in the " Proxy - State " attribute . @param packet the packet to proxy @param proxyConnection the RadiusProxyConnection for this packet @throws IOException
protected void proxyPacket(RadiusPacket packet, RadiusProxyConnection proxyConnection)
        throws IOException {
        synchronized (RadiusProxy.class) {
            proxyIndex++;
            String proxyIndexStr = Integer.toString(proxyIndex);
            packet.addAttribute(new RadiusAttribute(33, proxyIndexStr.getBytes()));
            proxyConnections.put(proxyIndexStr, proxyConnection);
        }
        InetAddress serverAddress = proxyConnection.getRadiusServer().getEndpointAddress().getAddress();
        int serverPort = proxyConnection.getRadiusServer().getEndpointAddress().getPort();
        String serverSecret = proxyConnection.getRadiusServer().getSharedSecret();
        byte[] auth = packet.getAuthenticator();
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        packet.encodeRequestPacket(bos, serverSecret);
        byte[] data = bos.toByteArray();
        DatagramPacket datagram = new DatagramPacket(data, data.length, serverAddress, serverPort);
        packet.setAuthenticator(auth);
        DatagramSocket proxySocket = getProxySocket();
        proxySocket.send(datagram);
    }
protected void proxyPacket ( RadiusPacket packet , RadiusProxyConnection proxyConnection ) throws IOException { synchronized ( RadiusProxy . class ) { proxyIndex ++ ; String proxyIndexStr = Integer . toString ( proxyIndex ) ; packet . addAttribute ( new RadiusAttribute ( 33 , proxyIndexStr . getBytes ( ) ) ) ; proxyConnections . put ( proxyIndexStr , proxyConnection ) ; } InetAddress serverAddress = proxyConnection . getRadiusServer ( ) . getEndpointAddress ( ) . getAddress ( ) ; int serverPort = proxyConnection . getRadiusServer ( ) . getEndpointAddress ( ) . getPort ( ) ; String serverSecret = proxyConnection . getRadiusServer ( ) . getSharedSecret ( ) ; byte [ ] auth = packet . getAuthenticator ( ) ; ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; packet . encodeRequestPacket ( bos , serverSecret ) ; byte [ ] data = bos . toByteArray ( ) ; DatagramPacket datagram = new DatagramPacket ( data , data . length , serverAddress , serverPort ) ; packet . setAuthenticator ( auth ) ; DatagramSocket proxySocket = getProxySocket ( ) ; proxySocket . send ( datagram ) ; }
Proxies the given packet to the server given in the proxy connection.
Proxies the given packet to the server given in the proxy connection .
// add Proxy-State attribute
 // store RadiusProxyConnection object
 // get server address
 // save request authenticator (will be calculated new)
 // encode new packet (with new authenticator)
 // restore original authenticator
 // send packet
