swift-grpc | A very simple gRPC library to use with Apple
kandi X-RAY | swift-grpc Summary
kandi X-RAY | swift-grpc Summary
A very simple gRPC library to use with Apple's swift-protobuf.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of swift-grpc
swift-grpc Key Features
swift-grpc Examples and Code Snippets
Community Discussions
Trending Discussions on swift-grpc
QUESTION
I have an XCTest which works with UI components. I tried to open a server socket within the xctext function using SwiftNIO.
I took the echo server example from here. and I simplified, removed the args with hardcoded values for the sake of a dirty test.
...ANSWER
Answered 2021-Dec-22 at 10:17Yes, that is possible, you can find many examples of this in the AsyncHTTPClient and SwiftNIO test suites.
The reason that yours doesn't work is because you shut down the MultiThreadedEventLoopGroup
right after binding the socket. So essentially you're starting everything up and then you shut it down again.
Also, for unit tests, I'd recommend binding to 127.0.0.1
only because you probably don't want connections from elsewhere. Another good idea is to use an ephemeral port, ie. have the system pick a free, random port automatically. You can achieve this by specifying port 0
. After you bind
the server Channel
you can then interrogate the server channel by using serverChannel.localAddress?.port!
about the port it picked.
Here's a full example with a client and a server in a test case.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install swift-grpc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page