Comments (13)
Hi,
When you disable proxy, it means toxiproxy stops to listen for that port.
If you are looking for different combination how to use Toxiproxy I suggest to check https://github.com/Shopify/toxiproxy/blob/master/scripts/test-e2e
The toxic has an option to specify where to make a problem on Toxiproxy -> Upstream connection or Upstream -> Toxiproxy.
Here is a ruby example: https://github.com/Shopify/toxiproxy#3-using-toxiproxy
from toxiproxy.
@miry I could not find a way to 'cut' connection.
from toxiproxy.
You can try to use one of the toxics:
from toxiproxy.
I tried this:
I used this for adding a disconnect https://www.testcontainers.org/modules/toxiproxy/
`proxy.toxics().bandwidth("CUT_CONNECTION_DOWNSTREAM", ToxicDirection.DOWNSTREAM, 0);
proxy.toxics().bandwidth("CUT_CONNECTION_UPSTREAM", ToxicDirection.UPSTREAM, 0);
//Try to perform an operation here.
proxy.toxics().get("CUT_CONNECTION_DOWNSTREAM").remove();
proxy.toxics().get("CUT_CONNECTION_UPSTREAM").remove();
`
The thing is that I can setup a client that waits and listen for incoming requests on port 4335.
Then I managed to trigger a "call home" from server to this client using testcontainers.
But problem seems to be the toxic.
NetconfClient <-- Toxic <-- NetconfSever
I have tried different toxics but it seems that they don't apply.
Is there something else I need to consider when I do downstream in java?
br,
//mike
from toxiproxy.
@miry another question. Is there a way to see if data is sent via the proxy created? Could I enable logging?
from toxiproxy.
@mpet Use env variable LOG_LEVEL=debug
to enable detailed logging. It should show connections information.
from toxiproxy.
@miry I tried to set it using VM arg like -DLOG_LEVEL=debug
Unsure what to look for. What should I see? Any examples?
from toxiproxy.
@miry is it possible to see if we go via ToxiProxy.
I use the container:
public ToxiproxyContainer toxiproxy = new ToxiproxyContainer("ghcr.io/shopify/toxiproxy:2.5.0")
.withNetwork(network);
from toxiproxy.
But I cannot really see a difference.
from toxiproxy.
@mpet I propose to play with toxiproxy-server
without Java. Check example how to enable log level trace for toxiproxy-server in https://github.com/Shopify/toxiproxy/blob/master/scripts/test-e2e#L44
from toxiproxy.
@miry I use the docker version. How can I enable debug in it?
from toxiproxy.
I managed to enable debug for the toxiproxy container. This is what I get when it is enabled:
2023-02-27 07:59:45,965 (Wire.java:92) DEBUG : http-outgoing-2 << "[0x1][0x0][0x0][0x0][0x0][0x0][0x0][0xffffffdb]{"level":"info","name":"netconfclient","listen":"toxi:65526","upstream":"host.testcontainers.internal:4335","client":"172.22.0.3:38742","caller":"proxy.go:186","time":"2023-02-27T06:59:45Z","message":"Accepted client"}[\n]"
2023-02-27 07:59:45,965 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0];[INF]: LN: Trying to connect via IPv4 to 172.22.0.2:65526.[\n]"
2023-02-27 07:59:45,965 (Wire.java:92) DEBUG : http-outgoing-2 << "[\r][\n]"
2023-02-27 07:59:45,965 (Wire.java:92) DEBUG : http-outgoing-4 << "[\r][\n]"
2023-02-27 07:59:45,965 (Slf4jLogConsumer.java:75) INFO : STDERR: [INF]: LN: Trying to connect via IPv4 to 172.22.0.2:65526.
2023-02-27 07:59:45,965 (Slf4jLogConsumer.java:68) INFO : STDOUT: {"level":"info","name":"netconfclient","listen":"toxi:65526","upstream":"host.testcontainers.internal:4335","client":"172.22.0.3:38742","caller":"proxy.go:186","time":"2023-02-27T06:59:45Z","message":"Accepted client"}
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "7f[\r][\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0];[INF]: LN: Successfully connected to toxi:65526 over IPv4.[\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0]4[INF]: SR: Session 98 (user "root", CID 1) created.[\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[\r][\n]"
2023-02-27 07:59:45,966 (Slf4jLogConsumer.java:75) INFO : STDERR: [INF]: LN: Successfully connected to toxi:65526 over IPv4.
2023-02-27 07:59:45,966 (Slf4jLogConsumer.java:75) INFO : STDERR: [INF]: SR: Session 98 (user "root", CID 1) created.
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "79[\r][\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0]4[INF]: SR: Session 99 (user "root", CID 1) created.[\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0]5[INF]: SR: Session 100 (user "root", CID 1) created.[\n]"
2023-02-27 07:59:45,966 (Wire.java:92) DEBUG : http-outgoing-4 << "[\r][\n]"
2023-02-27 07:59:45,966 (Slf4jLogConsumer.java:75) INFO : STDERR: [INF]: SR: Session 99 (user "root", CID 1) created.
2023-02-27 07:59:45,966 (Slf4jLogConsumer.java:75) INFO : STDERR: [INF]: SR: Session 100 (user "root", CID 1) created.
2023-02-27 07:59:45,987 (Wire.java:92) DEBUG : http-outgoing-2 << "151[\r][\n]"
2023-02-27 07:59:45,987 (Wire.java:92) DEBUG : http-outgoing-2 << "[0x1][0x0][0x0][0x0][0x0][0x0][0x1]I{"level":"error","name":"netconfclient","listen":"toxi:65526","upstream":"host.testcontainers.internal:4335","error":"dial tcp: lookup host.testcontainers.internal on 127.0.0.11:53: no such host","client":"172.22.0.3:38742","caller":"proxy.go:193","time":"2023-02-27T06:59:45Z","message":"Unable to open connection to upstream"}[\n]"
2023-02-27 07:59:45,987 (Wire.java:92) DEBUG : http-outgoing-2 << "[\r][\n]"
2023-02-27 07:59:45,987 (Slf4jLogConsumer.java:68) INFO : STDOUT: {"level":"error","name":"netconfclient","listen":"toxi:65526","upstream":"host.testcontainers.internal:4335","error":"dial tcp: lookup host.testcontainers.internal on 127.0.0.11:53: no such host","client":"172.22.0.3:38742","caller":"proxy.go:193","time":"2023-02-27T06:59:45Z","message":"Unable to open connection to upstream"}
2023-02-27 07:59:45,988 (Wire.java:92) DEBUG : http-outgoing-4 << "30[\r][\n]"
2023-02-27 07:59:45,988 (Wire.java:92) DEBUG : http-outgoing-4 << "[0x2][0x0][0x0][0x0][0x0][0x0][0x0]([ERR]: LN: SSL_accept failed (Success).[\n]"
2023-02-27 07:59:45,988 (Wire.java:92) DEBUG : http-outgoing-4 << "[\r][\n]"
2023-02-27 07:59:45,988 (Slf4jLogConsumer.java:75) INFO : STDERR: [ERR]: LN: SSL_accept failed (Success).
What is your interpretation of this?
//mike
from toxiproxy.
I see there is a mix of java app logs and toxiproxy-server.
There is an error, that says there is no upstream host:
{"level":"error","name":"netconfclient","listen":"toxi:65526","upstream":"host.testcontainers.internal:4335","error":"dial tcp: lookup host.testcontainers.internal on 127.0.0.11:53: no such host","client":"172.22.0.3:38742","caller":"proxy.go:193","time":"2023-02-27T06:59:45Z","message":"Unable to open connection to upstream"}
In those logs, I don't see any DEBUG level messages.
My suggestion is the same:
- Get some knowledge of "how it works" and "how to add toxics" with README.
- Play with
toxyproxy-server
andtoxiproxy-cli
without Testcontainers or other wrappers.
It would help you later to understand logs from Testcontainers.
If you still struggle with configuration toxiproxy,
I suggest asking reddit or stackoverflow for help.
We use github issues only for feature requests and bug reports.
In case you find an implementation problem of Toxiproxy let me know
by creating a new issue. Also, we are a welcome contribution to our docs.
from toxiproxy.
Related Issues (20)
- Unable to connect to RDS Aurora SQL DB via ToxiProxy server HOT 10
- is it possible to use ssh to connect to toxiproxy with a SSH server as backend. HOT 5
- Fails to connect after peer-reset HOT 6
- ToxiproxyContainer.ContainerProxy deprecated HOT 3
- How to proxy MTLS connections using Toxiproxy HOT 1
- Migrate the GH default branch to main HOT 1
- Reopen all the PRs that were closed unintentionally because of master -> main rename HOT 2
- RemoveToxic: HTTP 503: Unexpected response code, expected 204 HOT 5
- Possible to add toxics in config? HOT 1
- non-local API server connection refused when using '-config' HOT 1
- Dynamic / Conditional Toxics? HOT 2
- Tag and release v2.6.0? HOT 2
- panic: runtime error: slice bounds out of range [808:773]
- Difficulty Implementing Proxy for OpenAI API with App Calling and curl Insufficiency
- Proxy does not foward custom HTTP headers
- Unable to update toxic using prebuilt windows server
- Documentation for distribution of latency with different jitter values
- Is Redis Cluster/ PostGresDB Connection(based on master/slave architecture) supported for ToxiProxy ?
- Toxiproxy control port hangs on removing a toxic HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toxiproxy.