exposing a http-tcp-socket from within the subprocess
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 267
- Avg merge
- 1d 25m
- Merged PRs (30d)
- 14
Description
## :question: Guidance
### Affected Languages
- [ ] `TypeScript` or `Javascript`
- [ ] `Python`
- [x] `Java`
- [ ] .NET (`C#`, `F#`, ...)
- [ ] `Go`
### General Information
* **JSII Version:** `1.35.0 (build 6ebef96), typescript 3.9.10`
* **Platform:** `Darwin xxxx 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64`
### The Question
Hello, I'm trying evaluate the possibility to build a testing library that mocks a http server.
I tried some code:
```
async start(): Promise {
this._server = createServer({}, (req, res) => {
this._requestHandler(req, res);
});
return new Promise((resolve) => {
this._server!.listen(8080, () => {
console.log('server started')
resolve(null);
});
});
}
```
this works fine in node, however it seems I can't get a connection from my junit test:
```
// ktor
val httpClient = HttpClient(CIO)
val content = runBlocking {
httpClient.request {
timeout { requestTimeoutMillis = 1000 }
url(Url("http://localhost:8080/hello/world"))
method = Get
}
}
```
I've also hit an infinite sleep in the junit test and tried to curl the local address, however with no success.
could it be that it is not possible to expose a socket from the internal node process?
Contributor guide
Research direction
Start by reproducing the Java JUnit/Ktor request against the TypeScript start() entry point, then compare it with the reported curl and Node behavior. Determine whether the localhost socket is reachable from the internal subprocess and define what supported behavior or configuration would make the test complete successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, node.js, typescript
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100