code: public Response getResponse(PostData postData)
          throws ConnectException, SocketException
      {
          CheckedSocket socket = mFactory.getSocket(mSession);
  
          try {
              CharToByteBuffer request = new FastCharToByteBuffer
                  (new DefaultByteBuffer(), "8859_1");
              request = new InternedCharToByteBuffer(request);
  
              request.append(mMethod);
              request.append(' ');
              request.append(mURI);
              request.append(' ');
              request.append(mProtocol);
              request.append("\r\n");
              if (mHeaders != null) {
                  mHeaders.appendTo(request);
              }
              request.append("\r\n");
  
              Response response;
              try {
                  response = sendRequest(socket, request, postData);
              }
              catch (InterruptedIOException e) {
                  // If timed out, throw exception rather than risk double
                  // posting.
                  throw e;
              }
              catch (IOException e) {
                  response = null;
              }
  
              if (response == null) {
                  // Try again with new connection. Persistent connection may
                  // have timed out and been closed by server.
                  try {
                      socket.close();
                  }
                  catch (IOException e) {
                  }
  
                  socket = mFactory.createSocket(mSession);
  
                  response = sendRequest(socket, request, postData);
                  if (response == null) {
                      throw new ConnectException("No response from server " + socket.getInetAddress() + ":" +
                              socket.getPort());
                  }
              }
  
              return response;
          }
          catch (SocketException e) {
              throw e;
          }
          catch (InterruptedIOException e) {
              throw new ConnectException("Read timeout expired: " +
                                         mReadTimeout + ", " + e);
          }
          catch (IOException e) {
              throw new SocketException(e.toString());
          }
      }
docs: Opens a connection, passes on the current request settings, and returns
  the server's response. The optional PostData parameter is used to
  supply post data to the server. The Content-Length header specifies
  how much data will be read from the PostData InputStream. If it is not
  specified, data will be read from the InputStream until EOF is reached.
  
  @param postData additional data to supply to the server, if request
  method is POST