title: sending data to server with httpUrlConnection
body: <p>I am trying to create a Simplest WebServer and Client using HTTP. I should use a tunnel way that uses two connections at the same time; one is a GET connection to recieve data and the other is a POST connection to send data back.</p>
  <p>Below is my code:</p>
  <pre><code>//client GET Request
  setoURL(new URL(&quot;http://&quot; + input.getIp() + &quot;:&quot; + input.getPort() + input.getUrlPath()));
  conn = (HttpURLConnection) getoURL().openConnection();
              
  conn.setRequestMethod(&quot;GET&quot;);
  conn.setReadTimeout(5000);
  conn.addRequestProperty(&quot;User-Agent&quot;, &quot;VVTK (ver=40)&quot;);
  conn.addRequestProperty(&quot;Accept&quot;, &quot;application/x-vvtk-tunnelled&quot;);
  conn.addRequestProperty(&quot;x-sessioncookie&quot;, uniqueId());
  conn.addRequestProperty(&quot;Pragma&quot;, &quot;no-cache&quot;);
  conn.addRequestProperty(&quot;Cache-Control&quot;, &quot;no-cache&quot;);
  conn.setRequestProperty(&quot;Authorization&quot;,/*The Authorization*/);
  conn.getResponseCode();
  
  //Client POST request
  HttpURLConnection second2 = (HttpURLConnection) apiCommand.getoURL().openConnection();
  second2.setRequestMethod(&quot;POST&quot;);
  second2.setReadTimeout(5000);
  second2.setRequestProperty(&quot;User-Agent&quot;, &quot;VVTK (ver=40)&quot;);
  second2.setRequestProperty(&quot;x-sessioncookie&quot;, xsession);
  second2.setRequestProperty(&quot;Pragma&quot;, &quot;no-cache&quot;);
  second2.setRequestProperty(&quot;Cache-Control&quot;, &quot;no-cache&quot;);
  second2.setRequestProperty(&quot;Content-Length&quot;, &quot;7&quot;);
  second2.setRequestProperty(&quot;Expires&quot;, &quot;Sun, 9 Jan 1972 00:00:00 GMT&quot;);
  second2.setRequestProperty(&quot;VerifyPassProxy&quot;, &quot;yes&quot;);
  second2.setRequestProperty(&quot;Authorization&quot;, /*The Authorization*/);
  second2.setDoOutput(true);
  reqStream = new DataOutputStream(second2.getOutputStream());
  reqStream.writeBytes(&quot;Q2FuU2Vl&quot;);
  reqStream.flush();
  
  in = new BufferedReader(new InputStreamReader(second.getInputStream()));
  String inputLine = &quot;&quot;;
  while ((inputLine = in.readLine()) != null) {
      System.out.println(inputLine);
  }
  </code></pre>
  <p>The problem is the post request not sent. The first connection ((GET Request)) will send me the events or all responses. I should never disconnect or get data from the second connection (POST request).</p>
  <h3>Question</h3>
  <p>Why is the POST request not send?</p>