class Request {
    public String text;
    public int start;
    public int end;
    public List<String> candidates;

    public Request(String text, int start, int end, List<String> candidates) {
      this.text = text;
      this.start = start;
      this.end = end;
      this.candidates = candidates;
    }

    public ScoreRequest convert() {
      List<Mask> masks = Arrays.asList(Mask.newBuilder()
        .setStart(start)
        .setEnd(end)
        .addAllCandidates(candidates)
        .build());
      return ScoreRequest.newBuilder().setText(text).addAllMask(masks).build();
    }

    @Override
    public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;
      Request request = (Request) o;
      return start == request.start &&
        end == request.end &&
        text.equals(request.text) &&
        candidates.equals(request.candidates);
    }

    @Override
    public int hashCode() {
      return Objects.hash(text, start, end, candidates);
    }

  }

  public RemoteLanguageModel(String host, int port, boolean useSSL,
                             @Nullable String clientPrivateKey, @Nullable  String clientCertificate,
                             @Nullable String rootCertificate) throws SSLException {
    // TODO configure deadline/retries/... here?
    channel = getChannel(host, port, useSSL, clientPrivateKey, clientCertificate, rootCertificate);
    model = BertLmGrpc.newBlockingStub(channel);
  }

  private ManagedChannel getChannel(String host, int port, boolean useSSL,
                    @Nullable String clientPrivateKey, @Nullable  String clientCertificate,
                    @Nullable String rootCertificate) throws SSLException {<FILL_FUNCTION_BODY>

    NettyChannelBuilder channelBuilder = NettyChannelBuilder.forAddress(host, port);
    if (useSSL) {
      SslContextBuilder sslContextBuilder = GrpcSslContexts.forClient();
      if (rootCertificate != null) {
        sslContextBuilder.trustManager(new File(rootCertificate));
      }
      if (clientCertificate != null && clientPrivateKey != null) {
        sslContextBuilder.keyManager(new File(clientCertificate), new File(clientPrivateKey));
      }
      channelBuilder = channelBuilder.negotiationType(NegotiationType.TLS).sslContext(sslContextBuilder.build());
    } else {
      channelBuilder = channelBuilder.usePlaintext();
    }
    return channelBuilder.build();
  
<no_super_class>