Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exposing a http-tcp-socket from within the subprocess #3016

Open
1 of 5 tasks
jaecktec opened this issue Oct 3, 2021 · 2 comments
Open
1 of 5 tasks

exposing a http-tcp-socket from within the subprocess #3016

jaecktec opened this issue Oct 3, 2021 · 2 comments
Labels
bug This issue is a bug. effort/large Large work item – several weeks of effort module/runtime Issues affecting the `jsii-runtime` p2

Comments

@jaecktec
Copy link

jaecktec commented Oct 3, 2021

❓ Guidance

Affected Languages

  • TypeScript or Javascript
  • Python
  • 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<any> {
    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<String> {
        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?

@jaecktec jaecktec added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Oct 3, 2021
@RomainMuller
Copy link
Contributor

Async invocations are likely buggy in most languages, as these implementations have not been used in the wild so far, as far as I know. It might take a while to make them actually usable for this purpose...

This isn't currently the main area of focus for the team, so I don't think you should expect to see much movement coming from our side of the fence on this domain in the near future... That being said I'd be happy to take pull requests if you have some free time and are feeling brave (I'm happy to provide guidance, too).

@RomainMuller RomainMuller added bug This issue is a bug. effort/large Large work item – several weeks of effort module/runtime Issues affecting the `jsii-runtime` p2 and removed needs-triage This issue or PR still needs to be triaged. labels Oct 5, 2021
@peterwoodworth peterwoodworth removed the guidance Question that needs advice or information. label Mar 31, 2022
@TimothyJones
Copy link
Contributor

I have this exact case (building a testing library that mocks an http server) - I'd be happy to look in to this more if there is a good place to start looking. I think #4133 is related (and a possible cause), too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/large Large work item – several weeks of effort module/runtime Issues affecting the `jsii-runtime` p2
Projects
None yet
Development

No branches or pull requests

4 participants