<commit_before>package de.gesellix.docker.client.protocolhandler.urlstreamhandler

import org.newsclub.net.unix.AFUNIXSocket
import org.newsclub.net.unix.AFUNIXSocketAddress
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import sun.net.www.http.HttpClient

// behave like the sun internal HttpClient,
// but connect via unix socket to the docker daemon.
class HttpOverUnixSocketClient extends HttpClient {

  Logger logger = LoggerFactory.getLogger(HttpOverUnixSocketClient)

  static String dockerUnixSocket

  protected HttpOverUnixSocketClient(URL url) throws IOException {
    super(url, true)
  }

  @Override
  protected Socket doConnect(String host, int port) throws IOException, UnknownHostException {
    logger.debug "connect at host:port '${host}:${port}' via '${dockerUnixSocket}'..."

    File socketFile = new File(dockerUnixSocket)
    logger.debug "unix socket exists/canRead/canWrite: ${socketFile.exists()}/${socketFile.canRead()}/${socketFile.canWrite()}"

    Socket socket = AFUNIXSocket.newInstance()

    if (connectTimeout < 0) {
      connectTimeout = defaultConnectTimeout
    }
    socket.connect(new AFUNIXSocketAddress(socketFile), connectTimeout)

    if (readTimeout < 0) {
      readTimeout = defaultSoTimeout
    }
    if (this.readTimeout >= 0) {
      socket.setSoTimeout(defaultSoTimeout)
    }
    return socket
  }
}<commit_msg>make the logger available during initialization<commit_after>package de.gesellix.docker.client.protocolhandler.urlstreamhandler

import org.newsclub.net.unix.AFUNIXSocket
import org.newsclub.net.unix.AFUNIXSocketAddress
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import sun.net.www.http.HttpClient

// behave like the sun internal HttpClient,
// but connect via unix socket to the docker daemon.
class HttpOverUnixSocketClient extends HttpClient {

  final static Logger logger = LoggerFactory.getLogger(HttpOverUnixSocketClient)

  static String dockerUnixSocket

  protected HttpOverUnixSocketClient(URL url) throws IOException {
    super(url, true)
  }

  @Override
  protected Socket doConnect(String host, int port) throws IOException, UnknownHostException {
    logger.debug "connect at host:port '${host}:${port}' via '${dockerUnixSocket}'..."

    File socketFile = new File(dockerUnixSocket)
    logger.debug "unix socket exists/canRead/canWrite: ${socketFile.exists()}/${socketFile.canRead()}/${socketFile.canWrite()}"

    Socket socket = AFUNIXSocket.newInstance()

    if (connectTimeout < 0) {
      connectTimeout = defaultConnectTimeout
    }
    socket.connect(new AFUNIXSocketAddress(socketFile), connectTimeout)

    if (readTimeout < 0) {
      readTimeout = defaultSoTimeout
    }
    if (this.readTimeout >= 0) {
      socket.setSoTimeout(defaultSoTimeout)
    }
    return socket
  }
}
{'fraction_non_alphanumeric': 0.09445438282647585, 'fraction_numerical': 0.0035778175313059034, 'mean_word_length': 4.503937007874016, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6966860', 'n_tokens_mistral': 840, 'n_tokens_neox': 802, 'n_words': 191}