This example fires several requests over the same HttpConnection (i.e. the same socket). When in 'keep-alive' mode, HTTP continues using the existing connection, while paying attention to server responses. If the server explicitly requires a connection to be closed, HTTP will close it and then it will open a new connection to continue your session. You don't have to worry about this, just keep calling keepAlive() and it will magically do everything for you in the background. Just don't forget to pass false argument to the last call to indicate the server that is the last connection and that we want to close after receiving the last response. (if for some reasons the server does not respond correctly, you may close communication on the client-side with an explicit call to response.close()). One more thing - if a new connection has to be opened during this persistent session (when e.g. keep-alive max counter is finished or timeout expired) the same connection provider will be used as for the initial, first connection.