class AttachExample {

  public static void main(String[] args) throws IOException {<FILL_FUNCTION_BODY>}

  private static ExecWatch attach(KubernetesClient client, String namespace, String podName,
      CompletableFuture<Void> sessionFuture) {
    return client.pods().inNamespace(namespace).withName(podName)
        .redirectingInput()
        .writingOutput(System.out)
        .writingError(System.err)
        .withTTY()
        .usingListener(new ExecListener() {
          @Override
          public void onFailure(Throwable t, Response failureResponse) {
            sessionFuture.complete(null);
          }

          @Override
          public void onClose(int code, String reason) {
            sessionFuture.complete(null);
          }
        })
        .attach();
  }
}

    if (args.length < 1) {
      System.out.println("Usage: podName [namespace]");
      return;
    }

    String podName = args[0];
    String namespace = "default";

    if (args.length > 1) {
      namespace = args[1];
    }

    CompletableFuture<Void> sessionFuture = new CompletableFuture<>();
    try (
        KubernetesClient client = new KubernetesClientBuilder().build();
        ExecWatch watch = attach(client, namespace, podName, sessionFuture)) {
      System.out.println("Type 'exit' to detach");
      BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
      while (true) {
        String input = reader.readLine();
        if (input.equals("exit")) {
          return;
        }
        watch.getInput().write((input + "\n").getBytes(StandardCharsets.UTF_8));
        watch.getInput().flush();
        if (sessionFuture.isDone()) {
          System.out.println("Session closed");
          return;
        }
      }
    }
  
<no_super_class>