title: Netty client with synchronous request response
body: <p>i am trying to create a http client based on netty. I have written the code based on the <a href="https://github.com/netty/netty/blob/master/example/src/main/java/io/netty/example/http/snoop/HttpSnoopClient.java" rel="nofollow">HttpSnoopClient example</a> given in Netty site. But the problem is HttpResponse are handled by HttpSnoopClientHandler &amp; HttpRequests are sent in HttpSnoopClient &amp; i want to sync it. as in if i send a request i want to make sure that i will send the next request once i know the response to the previous. But since both are handled in different class, It is becoming difficult to do the same.</p>
  
  <p>One thing i did was to create a setResponse() method in HttpTarget &amp; HttpSnoopClientHandler will be setting the HttpResponse when it receives the Response from the sever. But i don't think it is a good approach since i won't be able to know the reposne was for which request.</p>
  
  <p>So basically i want to do it synchronously i.e. send a request(channel.writeandFlush(req)) in HttpSnoopClient then wait till the response is received by the HttpSnoopCLientHandler &amp; once it recieves a HTTP 1.1 200 OK then send the next request.</p>
  
  <p>Can anyone tell me a good approach for doing it. Thanks in advance!</p>