https://www.wiremock.io logo
Join Slack
Channels
help
general
wiremock-dotnet
wiremock-go
wiremock-studio
wiremock-js
wiremock-cloud
wiremock-java
wiremock-python
introduce-yourself
documentation
random
stackoverflow
announcements
Powered by
# wiremock-java
  • t

    Tom

    01/17/2023, 1:47 PM
    IIRC it will usually try to determine which mode to use based on the request entity object. If it can determine the length it’ll send the Content-Length header, otherwise it’ll go chunked.
  • r

    Russ Garratt

    01/17/2023, 1:53 PM
    i'll try and look in the code and see if it is being set
  • r

    Russ Garratt

    01/17/2023, 1:53 PM
    might be a bug in their sdk
  • r

    Russ Garratt

    01/17/2023, 3:59 PM
    hmm, seems i can only work with jre8-standalone
  • t

    Tom

    01/17/2023, 4:00 PM
    Because there’s a conflicting version of HTTPClient in the non-standalone version?
  • r

    Russ Garratt

    01/17/2023, 4:00 PM
    i think so
  • r

    Russ Garratt

    01/17/2023, 4:00 PM
    between gradle + our dependency
  • r

    Russ Garratt

    01/17/2023, 4:04 PM
    4.5.14 (sdk + org.springframework.cloudspring cloud test support4.0.0) 5:5.1.4 (org.springframework.cloudspring cloud contract wiremock4.0.0) + gradle also seemed to have it bundled in (gradle 7.6 - 4.4.16 + kotlin gradle plugin 1.8)
  • t

    Tom

    01/17/2023, 4:05 PM
    I think 4 and 5 should be able to cohabit, since 5 has got
    client5
    in its artifact name and packages
  • t

    Tom

    01/17/2023, 4:06 PM
    Having said that at the moment standalone is usually the best bet when working with Spring. Is there a specific issue you have with that one?
  • r

    Russ Garratt

    01/17/2023, 4:07 PM
    just fails to bind now i think
  • t

    Tom

    01/17/2023, 4:08 PM
    Can you share the details? I know many teams use standalone as a dependency with Spring, including the Spring Cloud Contract team, so it should work OK.
  • r

    Russ Garratt

    01/17/2023, 4:08 PM
    prob my code, will check
  • r

    Russ Garratt

    01/17/2023, 4:08 PM
    on latest 3. beta version?
  • t

    Tom

    01/17/2023, 4:09 PM
    The 3.x beta fixes the main reason you need to use standalone, so with that you should be able to use either. If you want to use 2.x with Spring Boot 3.x you’ll need standalone.
  • r

    Russ Garratt

    01/17/2023, 4:10 PM
    would like to say thanks for all the help you have given so far!
  • t

    Tom

    01/17/2023, 4:10 PM
    No problem!
  • s

    Sinan Pehlivanoglu

    01/17/2023, 5:43 PM
    Hello! I have been trying to port our tests from MockServer to WireMock at work. Sadly it hasn't gone as smooth as I was hoping. I hit some issues, was hoping you could give a few ideas. I had some original questions but in the time being WireMockServer completely stopped working 😅
    Copy code
    Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.
    java.lang.IllegalStateException: Not listening on HTTP port. Either HTTP is not enabled or the WireMock server is stopped.
    	at wiremock.com.google.common.base.Preconditions.checkState(Preconditions.java:444)
    	at com.github.tomakehurst.wiremock.WireMockServer.port(WireMockServer.java:179)
    Found this: https://github.com/bakdata/fluent-kafka-streams-tests/issues/22 and this: https://groups.google.com/g/wiremock-user/c/4kkOMn58CzM?pli=1 JUnit version
    4.13.2
    testImplementation "junit:junit:4.13.2"
    Being going through the recently merged code to see what could have caused this in the past 24 hours but I can't quite tell.
    Copy code
    private Environment newEnvironmentInstance(.....) {
            .... some code here .... 
    
            final WireMockConfiguration config = wireMockConfig().dynamicPort();
            final WireMockServer mockServer = new WireMockServer(config);
            environment.setUrl(URI.create("<http://localhost>:" + mockServer.port()));
            environment.setService(URI.create("<http://localhost>:" + mockServer.port()));
            environment.setInitial(initial);
            <http://logger.info|logger.info>("Environment started: {} on port {} ({})",
                    environment.getId(), mockServer.port(), environment.getName());
    
            mockServer.start();
    
            mockServer.stubFor(.....)
      }
    Any thoughts what might have caused this?
  • t

    Tom

    01/17/2023, 5:54 PM
    Hi @Sinan Pehlivanoglu you need to call
    mockServer.start()
    before
    mockServer.port()
    since when you use dynamically assigned ports they’re only assigned at startup.
  • s

    Sinan Pehlivanoglu

    01/17/2023, 6:10 PM
    Thank you!
    👍 1
  • s

    Slackbot

    01/18/2023, 3:22 PM
    This message was deleted.
    t
    n
    • 3
    • 5
  • i

    ines rattab

    01/19/2023, 7:51 AM
    Hello, I'm using wiremock to test mutual ssl connection with an external API. But i'm getting this error
    client_cacerts.jks is not a valid keystore
    , although it is valid , here is the code
    Copy code
    WireMockServer wireMock = new WireMockServer(wireMockConfig()
          //.port(8080)
          .httpsPort(8443)
          .needClientAuth(true)
          .keystoreType("jks")
          .keystorePath("client_keystore.jks") // Either a path to a file or a resource on the classpath
          .keystorePassword("secret")
          .keyManagerPassword("secret")
          .trustStorePath("client_cacerts.jks")// The password used to access the keystore. Defaults to "password" if omitted
          .trustStorePassword("secret")
    );
    @Test
    void test() {
       wireMock.start();
       wireMock.stubFor(
             WireMock.get("/hello")
                   .willReturn(WireMock.ok("world"))
       );
    Any thoughts what might be causing this error ?
  • s

    Slackbot

    01/19/2023, 4:24 PM
    This message was deleted.
    t
    • 2
    • 1
  • s

    Sofia Pacifico

    01/19/2023, 5:59 PM
    Hi everyone, hope my message finds you well. I am using wiremock docker image and I am working on some security vulnerabilities founded, for example in the sqlite version (SQLite 1.0.12 through 3.39.x before 3.39.2 sometimes allows an array-bounds overflow if billions of bytes are used in a string argument to a C API.) is something that I should ignore or someone can help me to upgrade the version? In advance, thanks for your help!
  • s

    Slackbot

    01/19/2023, 7:34 PM
    This message was deleted.
    👍 1
    s
    t
    • 3
    • 5
  • s

    Slackbot

    01/20/2023, 8:46 AM
    This message was deleted.
    r
    d
    • 3
    • 8
  • s

    Slackbot

    01/20/2023, 9:54 AM
    This message was deleted.
    t
    a
    • 3
    • 6
  • s

    Slackbot

    01/20/2023, 5:15 PM
    This message was deleted.
    👀 1
    t
    a
    p
    • 4
    • 9
  • j

    Joaquin Penalver

    01/24/2023, 9:12 AM
    Hello I've a question for someone expert in wiremock
  • j

    Joaquin Penalver

    01/24/2023, 9:14 AM
    We're using wiremock-studio:2.32.0-18 docker image, I'm trying to pass some arguments to the docker image in order to customize it, for example enabling HTTPS but the wiremock throw an error
    Copy code
    wiremock    | Exception in thread "main" joptsimple.UnrecognizedOptionException: https-port is not a recognized option
1234Latest