class IlpOverHttpLink extends AbstractLink<IlpOverHttpLinkSettings> implements Link<IlpOverHttpLinkSettings> {

  public void testConnection() {
    try {
      final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET);

      try (Response response = okHttpClient.newCall(okHttpRequest).execute()) {
        if (response.isSuccessful()) {
          //////////
          // Success
          // If there's one Accept header we can work with, then treat this as a successful test connection...
          boolean responseHasOctetStreamContentType = response.headers(CONTENT_TYPE).stream()
              .findFirst()
              .filter(OCTET_STREAM_STRING::equals)
              .isPresent();

          if (responseHasOctetStreamContentType) {
            logger.info("Remote peer-link supports ILP-over-HTTP. url={} responseHeaders={}",
                outgoingUrl, response
            );
          } else {
            logger.warn("Remote peer-link supports ILP-over-HTTP but uses wrong ContentType. url={} "
                    + "response={}",
                outgoingUrl, response
            );
          }
        } else {
          if (response.code() == 406 || response.code() == 415) { // NOT_ACCEPTABLE || UNSUPPORTED_MEDIA_TYPE
            throw new LinkException(
                String.format("Remote peer-link DOES NOT support ILP-over-HTTP. url=%s response=%s",
                    outgoingUrl, response
                ), getLinkId()
            );
          } else {
            throw new LinkException(
                String.format("Unable to connect to ILP-over-HTTP. url=%s response=%s",
                    outgoingUrl, response
                ), getLinkId()
            );
          }
        }
      }
    } catch (IOException e) {
      throw new LinkException(e.getMessage(), e, getLinkId());
    }
  }

  public  IlpOverHttpLink(
      final Supplier<InterledgerAddress> operatorAddressSupplier,
      final HttpUrl outgoingUrl,
      final OkHttpClient okHttpClient,
      final ObjectMapper objectMapper,
      final CodecContext ilpCodecContext,
      final BearerTokenSupplier bearerTokenSupplier
  );

}