

import java.io.InputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;

public class LongResponseHeaderDemoHttpURLConnection {
  public static void main(String[] args) throws Exception {
    int port = args.length == 0 ? 3000 : Integer.parseInt(args[0]);

    byte[] responseBody;
    try (InputStream in = new URL("http://localhost:" + port).openStream()) {
      responseBody = in.readAllBytes();
    }

    System.out.println(new String(responseBody, StandardCharsets.UTF_8));
  }
}
