code: public void send(DatagramPacket dp, String host) throws IOException{
       if(proxy.isDirect(host)){
          dp.setAddress(InetAddress.getByName(host));
          super.send(dp);
          return;
       }
  
       if(((Socks5Proxy)proxy).resolveAddrLocally){
          dp.setAddress(InetAddress.getByName(host));
       }
  
       byte[] head = formHeader(host,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: This method allows to send datagram packets with address type DOMAINNAME.
  SOCKS5 allows to specify host as names rather than ip addresses.Using
  this method one can send udp datagrams through the proxy, without having
  to know the ip address of the destination host.
  <p>
  If proxy specified for that socket has an option resolveAddrLocally set
  to true host will be resolved, and the datagram will be send with address
  type IPV4, if resolve fails, UnknownHostException is thrown.
  @param dp Datagram to send, it should contain valid port and data
  @param host Host name to which datagram should be send.
  @throws IOException If error happens with I/O, or the host can't be
  resolved when proxy settings say that hosts should be resolved locally.
  @see Socks5Proxy#resolveAddrLocally(boolean)