@Override
    public Collection<Ticket> search(Map<String, String> params) {
        //TODO make real search: building tree, etc
        long requestId = this.findFreeKey(this.foundTicketStatuses);
        this.foundTicketStatuses.put(requestId, false);
        MsgFindTicket msg = new MsgFindTicket(this.address, this.ms.getAddressService().getAccountService(), params, requestId);
        this.ms.sendMessage(msg);
        while (!this.foundTicketStatuses.get(requestId)){
            try {
                this.ms.execForAbonent(this);
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        if (!this.foundTicketResults.get(requestId).isEmpty()){
            ArrayList<SingleTicket> singleTickets = new ArrayList<>();
            //for (SingleTicket ticket : this.foundTicketResults.get(requestId)) {
            //    singleTickets.add(ticket);
            //}
            singleTickets.add(this.foundTicketResults.get(requestId).iterator().next());
            Ticket tmpTicket = new TicketImp(singleTickets,false);
            ArrayList<Ticket> rez = new ArrayList<>();
            rez.add(tmpTicket);
            //removing used values
            this.foundTicketStatuses.remove(requestId);
            this.foundTicketResults.remove(requestId);
            return rez;
        }
        //removing used values
        this.foundTicketStatuses.remove(requestId);
        this.foundTicketResults.remove(requestId);
        ArrayList<Ticket> rez = new ArrayList<>();
        return rez;
    }