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

Tcp connection reusage #2213

Closed
wants to merge 3 commits into from

Conversation

mj11pyqe
Copy link

Description

Thanks for contributing this Pull Request. Make sure that you submit this Pull Request against the develop branch of this repository, add a brief description, and tag the relevant issue(s) and PR(s) below.

@ptrthomas
Copy link
Member

ptrthomas commented Dec 11, 2022

@mj11pyqe sorry, can you please resolve conflicts. maybe you have not pulled latest version

image

@ptrthomas
Copy link
Member

also can you please make the diff as small as possible (else it is too hard to review)

if we can't merge this, please note that using your own http client, is easy in karate, there is an API to swap it. so you can do this for some time and report back how it works. else I am not confident making this change without more testing

refer the docs here: https://github.com/karatelabs/karate/tree/master/karate-mock-servlet#switching-the-http-client

@mj11pyqe
Copy link
Author

My bad, I requested to merge wrong branch, it is old indeed, will open new pull request instead

if we can't merge this, please note that using your own http client, is easy in karate, there is an API to swap it. so you can do this for some time and report back how it works. else I am not confident making this change without more testing

Thank you so much for the hint, was not aware of this

@mj11pyqe mj11pyqe closed this Dec 12, 2022
@mj11pyqe
Copy link
Author

will not create a pull request, there is always an error that I could not fix.

For reference: using own httpClient as mentioned in https://github.com/karatelabs/karate/tree/master/karate-mock-servlet#switching-the-http-client works pretty well.

This is what I did.

public interface ReusableHttpClientFactory extends HttpClientFactory {
  HttpClientFactory CUSTOM = ReusableHttpClient::new;
}

public class ReusableHttpClient implements HttpClient {
//copied karate implementation and then adapted it.
}
public class AllTestsRunner {

  @Test
  void testAll() {
    Results results =
        Runner.path("classpath:com/x/y/z")
            .clientFactory(ReusableHttpClientFactory.CUSTOM)
            .parallel(1);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants