ursachec/CPAProxy — pull request #15 by davidchiles (2014-10-17 18:21:57+00:00)
Title: Added GCDAsyncSocket & tor control port commands and response parsing

Added GCDAsyncSocket as method for connecting to socket instead of custom socket setup.

More info on the [TOR control port commands.](https://gitweb.torproject.org/torspec.git?a=blob_plain;hb=HEAD;f=control-spec.txt)

## Commands

- `CPAProxyCommand` - Object that contains the actual command string and response block that should be called. When a command is sent to the `CPASocketManager` the string is sent over the control port and then queued waiting for a response from TOR (normally `250 OK`). Once the response is received the command is removed from the queue and sent into the delegate via `- (void)socketManager:(CPASocketManager *)manager didReceiveResponse:(NSString *)response forCommand:(CPAProxyCommand *)command;`. If there is not a queued command or the response is asynchronous the method is called on the delegate but command is nil.

## Response

- `CPAProxyResponseParser` - This class is just a way to organize all the specific parsing code to retrieve status codes and such. More methods should be added here as more responses are handled.
- `CPASocketManager` - There is now code to better handle asynchronous responses (status code 650). This includes multi line responses ending in '.' and connecting a given response to the command that initiated it.