/**
  * Returns the response to the SOCKS5 Bytestream request containing the SOCKS5 proxy used.
  *
  * @param selectedHost the used SOCKS5 proxy
  * @return the response to the SOCKS5 Bytestream request
  */
 private Bytestream createUsedHostResponse(StreamHost selectedHost) {
   Bytestream response = new Bytestream(this.bytestreamRequest.getSessionID());
   response.setTo(this.bytestreamRequest.getFrom());
   response.setType(IQ.Type.RESULT);
   response.setPacketID(this.bytestreamRequest.getPacketID());
   response.setUsedHost(selectedHost.getJID());
   return response;
 }
    @Override
    public boolean accept(Packet packet) {
      if (super.accept(packet)) {
        Bytestream bytestream = (Bytestream) packet;

        // packet must by of type SET and contains the given session ID
        return this.sessionID.equals(bytestream.getSessionID())
            && IQ.Type.SET.equals(bytestream.getType());
      }
      return false;
    }