code: public boolean isProxyAlive(int timeout){
       if(server_mode) return false;
       if(proxy != null){
           try{
             proxy.proxySocket.setSoTimeout(timeout);
  
             int eof = proxy.in.read();
             if(eof < 0) return false; // EOF encountered.
             else return true;         // This really should not happen
  
           }catch(InterruptedIOException iioe){
              return true;          // read timed out.
           }catch(IOException ioe){
              return false;
           }
       }
       return false;
     }
docs: This method checks wether proxy still runs udp forwarding service
  for this socket.
  <p>
  This methods checks wether the primary connection to proxy server
  is active. If it is, chances are that proxy continues to forward
  datagrams being send from this socket. If it was closed, most likely
  datagrams are no longer being forwarded by the server.
  <p>
  Proxy might decide to stop forwarding datagrams, in which case it
  should close primary connection. This method allows to check, wether
  this have been done.
  <p>
  You can specify timeout for which we should be checking EOF condition
  on the primary connection. Timeout is in milliseconds. Specifying 0 as
  timeout implies infinity, in which case method will block, until
  connection to proxy is closed or an error happens, and then return false.
  <p>
  One possible scenario is to call isProxyactive(0) in separate thread,
  and once it returned notify other threads about this event.
  
  @param timeout For how long this method should block, before returning.
  @return true if connection to proxy is active, false if eof or error
  condition have been encountered on the connection.