31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import "OFAutoreleasePool.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFHTTPClient";
static OFCondition *cond;
@interface OFHTTPClientTestsServer: OFThread
{
@public
uint16_t _port;
}
@end
@implementation OFHTTPClientTestsServer
- main
{
OFTCPSocket *listener, *client;
[cond lock];
listener = [OFTCPSocket socket];
|
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#import "OFAutoreleasePool.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFHTTPClient";
static OFCondition *cond;
@interface HTTPClientTestsServer: OFThread
{
@public
uint16_t _port;
}
@end
@implementation HTTPClientTestsServer
- main
{
OFTCPSocket *listener, *client;
[cond lock];
listener = [OFTCPSocket socket];
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
@"bar"];
[client close];
return nil;
}
@end
@implementation TestsAppDelegate (OFHTTPClientests)
- (void)HTTPClientTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFHTTPClientTestsServer *server;
OFURL *url;
OFHTTPClient *client;
OFHTTPRequest *request;
OFHTTPResponse *response = nil;
OFDataArray *data;
cond = [OFCondition condition];
[cond lock];
server = [[[OFHTTPClientTestsServer alloc] init] autorelease];
[server start];
[cond wait];
[cond unlock];
url = [OFURL URLWithString:
[OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo",
|
|
|
|
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
@"bar"];
[client close];
return nil;
}
@end
@implementation TestsAppDelegate (OFHTTPClientTests)
- (void)HTTPClientTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
HTTPClientTestsServer *server;
OFURL *url;
OFHTTPClient *client;
OFHTTPRequest *request;
OFHTTPResponse *response = nil;
OFDataArray *data;
cond = [OFCondition condition];
[cond lock];
server = [[[HTTPClientTestsServer alloc] init] autorelease];
[server start];
[cond wait];
[cond unlock];
url = [OFURL URLWithString:
[OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo",
|