title: Why does my java client always return null when I try to read response from a global server?
body: <p>This sends a message to the server which in response is supposed to return "ok". I know this works because I also tried it in python and it worked 100%. But in java I am not able to get the response back.</p>
  
  <pre><code> String host = "(name of global host)";
    s.connect(new InetSocketAddress(host, 80));
  
  System.out.println("Connected");
  
      OutputStream os = s.getOutputStream();
      OutputStreamWriter osw = new OutputStreamWriter(os);
      BufferedWriter bw = new BufferedWriter(osw);
      bw.write("(insert message to sent to server here)");
      bw.flush(); 
  
  BufferedReader brz = new BufferedReader(new InputStreamReader(s.getInputStream()));
          String t;
          while((t = brz.readLine()) != null){
          System.out.println(t);
           }
          brz.close();
  s.close();
  // The loop doesn't even run because it returns null
  </code></pre>
  
  <p>And here is the python code which works perfectly fine unlike java one</p>
  
  <pre><code>     HOST, PORT = "(host name)", 80
   self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
      self.sock.settimeout(10)
      self.wrappedSocket = ssl.wrap_socket(self.sock)
  
      initial_connection_payload = '(text to send to server)'.encode('UTF-8')
  
      self.wrappedSocket.connect((HOST, PORT))
      self.wrappedSocket.send(initial_connection_payload)
      response = self.wrappedSocket.recv(16384).decode('UTF-8')
      if "ok" not in response:
          self._log(response, "[!] Could not connect to server: " + response)
  
      self._log("[+] Connected.")
  </code></pre>
  
  <p>So my question is what am I doing wrong in java? I have even tried other ways of doing this such as printwriter dataoutputstream etc. and even tried reading from scanner or just InputStream alone but nothing works. Any help would be appreciated   </p>