code: public void send(DatagramPacket dp) throws IOException{
       //If the host should be accessed directly, send it as is.
       if(!server_mode && proxy.isDirect(dp.getAddress())){
          super.send(dp);
          //debug("Sending directly:");
          return;
       }
  
       byte[] head = formHeader(dp.getAddress(),dp.getPort());
       byte[] buf = new byte[head.length + dp.getLength()];
       byte[] data = dp.getData();
       //Merge head and data
       System.arraycopy(head,0,buf,0,head.length);
       //System.arraycopy(data,dp.getOffset(),buf,head.length,dp.getLength());
       System.arraycopy(data,0,buf,head.length,dp.getLength());
  
       if(encapsulation != null)
          buf = encapsulation.udpEncapsulate(buf,true);
  
       super.send(new DatagramPacket(buf,buf.length,relayIP,relayPort));
     }
docs: Sends the Datagram either through the proxy or directly depending
  on current proxy settings and destination address. <BR>
  
  <B> NOTE: </B> DatagramPacket size should be at least 10 bytes less
  than the systems limit.
  
  <P>
  See documentation on java.net.DatagramSocket
  for full details on how to use this method.
  @param dp Datagram to send.
  @throws IOException If error happens with I/O.