class RestP2pClient implements P2pClient {

    @Override
    public boolean sendPartyInfo(final String targetUrl, final byte[] data) {
        LOGGER.debug("Sending PartyInfo to peer {}", targetUrl);

        try (Response response =
                 client.target(targetUrl)
                     .path("/partyinfo")
                     .request()
                     .post(Entity.entity(data, MediaType.APPLICATION_OCTET_STREAM_TYPE))) {

            final int returnStatusCode = response.getStatus();
            if (Status.OK.getStatusCode() != returnStatusCode
                && Status.CREATED.getStatusCode() != returnStatusCode) {
                LOGGER.warn("PartyInfo returned status code for peer {} was {}", targetUrl, returnStatusCode);
                return false;
            }

            LOGGER.debug("Successful PartyInfo call to {}", targetUrl);
            return Objects.nonNull(response.readEntity(byte[].class));
        }
    }

    public  RestP2pClient(final Client client);

}