|
|
|
@ -87,8 +87,8 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
|
|
|
|
|
|
- (GRPCInterceptor *)createInterceptorWithManager:(GRPCInterceptorManager *)interceptorManager { |
|
|
|
|
dispatch_queue_t queue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL); |
|
|
|
|
return [[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager |
|
|
|
|
dispatchQueue:queue]; |
|
|
|
|
return |
|
|
|
|
[[GRPCInterceptor alloc] initWithInterceptorManager:interceptorManager dispatchQueue:queue]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@end |
|
|
|
@ -96,13 +96,12 @@ BOOL isRemoteInteropTest(NSString *host) { |
|
|
|
|
@interface HookInterceptorFactory : NSObject<GRPCInterceptorFactory> |
|
|
|
|
|
|
|
|
|
- (instancetype) |
|
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
|
writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
@ -119,7 +118,7 @@ initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
|
|
|
|
|
- (instancetype) |
|
|
|
|
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
@ -152,13 +151,12 @@ dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
- (instancetype) |
|
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, GRPCCallOptions *callOptions, |
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
|
writeDataHook:(void (^)(id data, GRPCInterceptorManager *manager))writeDataHook |
|
|
|
|
finishHook:(void (^)(GRPCInterceptorManager *manager))finishHook |
|
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
|
receiveNextMessagesHook:(void (^)(NSUInteger numberOfMessages, |
|
|
|
|
GRPCInterceptorManager *manager))receiveNextMessagesHook |
|
|
|
|
responseHeaderHook:(void (^)(NSDictionary *initialMetadata, |
|
|
|
|
GRPCInterceptorManager *manager))responseHeaderHook |
|
|
|
@ -216,7 +214,7 @@ initWithDispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
|
|
|
|
|
- (instancetype) |
|
|
|
|
initWithInterceptorManager:(GRPCInterceptorManager *)interceptorManager |
|
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
startHook:(void (^)(GRPCRequestOptions *requestOptions, |
|
|
|
|
GRPCCallOptions *callOptions, |
|
|
|
|
GRPCInterceptorManager *manager))startHook |
|
|
|
@ -230,8 +228,7 @@ dispatchQueue:(dispatch_queue_t)dispatchQueue |
|
|
|
|
responseCloseHook:(void (^)(NSDictionary *trailingMetadata, NSError *error, |
|
|
|
|
GRPCInterceptorManager *manager))responseCloseHook |
|
|
|
|
didWriteDataHook:(void (^)(GRPCInterceptorManager *manager))didWriteDataHook { |
|
|
|
|
if ((self = [super initWithInterceptorManager:interceptorManager |
|
|
|
|
dispatchQueue:dispatchQueue])) { |
|
|
|
|
if ((self = [super initWithInterceptorManager:interceptorManager dispatchQueue:dispatchQueue])) { |
|
|
|
|
_startHook = startHook; |
|
|
|
|
_writeDataHook = writeDataHook; |
|
|
|
|
_finishHook = finishHook; |
|
|
|
@ -1269,7 +1266,6 @@ static dispatch_once_t initGlobalInterceptorFactory; |
|
|
|
|
} |
|
|
|
|
__weak XCTestExpectation *expectation = [self expectationWithDescription:@"Keepalive"]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NSNumber *kRequestSize = @27182; |
|
|
|
|
NSNumber *kResponseSize = @31415; |
|
|
|
|
|
|
|
|
@ -1284,13 +1280,14 @@ static dispatch_once_t initGlobalInterceptorFactory; |
|
|
|
|
options.keepaliveTimeout = 0; |
|
|
|
|
|
|
|
|
|
__block GRPCStreamingProtoCall *call = [_service |
|
|
|
|
fullDuplexCallWithResponseHandler:[[InteropTestsBlockCallbacks alloc] |
|
|
|
|
fullDuplexCallWithResponseHandler: |
|
|
|
|
[[InteropTestsBlockCallbacks alloc] |
|
|
|
|
initWithInitialMetadataCallback:nil |
|
|
|
|
messageCallback:nil |
|
|
|
|
closeCallback:^(NSDictionary *trailingMetadata, |
|
|
|
|
NSError *error) { |
|
|
|
|
closeCallback:^(NSDictionary *trailingMetadata, NSError *error) { |
|
|
|
|
XCTAssertNotNil(error); |
|
|
|
|
XCTAssertEqual(error.code, GRPC_STATUS_UNAVAILABLE, |
|
|
|
|
XCTAssertEqual( |
|
|
|
|
error.code, GRPC_STATUS_UNAVAILABLE, |
|
|
|
|
@"Received status %ld instead of UNAVAILABLE (14).", |
|
|
|
|
error.code); |
|
|
|
|
[expectation fulfill]; |
|
|
|
|