|
| 1 | + |
| 2 | +<!--This file is autogenerated. Do not edit!--> |
| 3 | +In this demo you will |
| 4 | + |
| 5 | +* Install Java 11 |
| 6 | +* Start locally HAM server |
| 7 | +* Connect to it through proxy |
| 8 | + |
| 9 | +Download the ham tar.gz from [github releases](https://github.com/kendarorg/HttpAnsweringMachine/releases) |
| 10 | +and extract it |
| 11 | + |
| 12 | + |
| 13 | +<b>Ensure your application is calling -ONLY- http pages or it will not record the |
| 14 | +interactions content</b> |
| 15 | + |
| 16 | + |
| 17 | +## Configure proxy<a id="proxy_01"></a> |
| 18 | + |
| 19 | +Should set the proxy to 127.0.0.1 And port 1080 for socks5 or 1081 for http/https |
| 20 | + |
| 21 | +<details> |
| 22 | + <summary>Click me for more explanations</summary> |
| 23 | + |
| 24 | +* Chrome: |
| 25 | + * Install [Proxy Switch Omega](https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif) |
| 26 | + * Go to options |
| 27 | + * Add http and https proxy server with |
| 28 | + * Address: 127.0.0.1 |
| 29 | + * Port 1081. |
| 30 | + |
| 31 | + <img alt="Ham Proxyes" src="../images/chrome_proxy.gif" width="500"/> |
| 32 | + * Select "proxy" from the extension menu and back to "direct" when you want to disconnect |
| 33 | + * |
| 34 | + <img alt="Ham Proxyes" src="../images/chrome_proxy_switch.gif" width="100"/> |
| 35 | + |
| 36 | +* Firefox |
| 37 | + * Navigate to [about:preferences](about:preferences) |
| 38 | + * Search for "proxy" |
| 39 | + * Click on "Settings" |
| 40 | + * Go to "Manual proxy Configuration" |
| 41 | + * Select the socks5 proxy |
| 42 | + * Address: 127.0.0.1 |
| 43 | + * Port 1080 |
| 44 | + * Check the "Proxy DNS when using SOCKS v5" flag |
| 45 | + * Clean the settings when needed |
| 46 | + |
| 47 | + <img alt="Ham Proxyes" src="../images/firefox_proxy.gif" width="500"/> |
| 48 | + |
| 49 | +</details> |
| 50 | + |
| 51 | + |
| 52 | +## Configure the application proxy<a id="appproxy_01"></a> |
| 53 | + |
| 54 | +Here is configured for both http and https BUT only http traffic will be intercepted |
| 55 | + |
| 56 | +### On the application |
| 57 | + |
| 58 | +* [On Baeldung for java](https://www.baeldung.com/java-connect-via-proxy-server) |
| 59 | + |
| 60 | +Just add to the java command to start the application the following: |
| 61 | + |
| 62 | +<pre> |
| 63 | + -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=1081 |
| 64 | + -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=1081 |
| 65 | +</pre> |
| 66 | + |
| 67 | +* [Some C# suggestions](https://dotnetcoretutorials.com/2021/07/11/socks-proxy-support-in-net/?series) |
| 68 | + |
| 69 | +### On HAM configuration |
| 70 | + |
| 71 | +First ensure that all the ports called by your application are set on the |
| 72 | +file httpproxy.external.json in the "http" section. In the example here the |
| 73 | +http listen on 80, 8081 and 8082 |
| 74 | + |
| 75 | +<pre> |
| 76 | + { |
| 77 | + "id": "http", |
| 78 | + "system": true, |
| 79 | + "active": true, |
| 80 | + "port": "80;8081;8082", |
| 81 | + "backlog": 50, |
| 82 | + "useCachedExecutor": true |
| 83 | + }, |
| 84 | +</pre> |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | +## Run!! |
| 89 | + |
| 90 | +Start the HAM application with the "httpproxy.run.bat/sh" |
| 91 | +Start your appplication |
| 92 | +## Record some interaction<a id="createrecording_01"></a> |
| 93 | + |
| 94 | +You can now check ham application going on http://localhost |
| 95 | + |
| 96 | +* You can create a recording on the [recording page](http://www.local.test/plugins/recording) |
| 97 | + |
| 98 | +<img alt="Create recording" src="../images/create_recording.gif" width="500"/> |
| 99 | + |
| 100 | +* Once you create the recording you can start recording! |
| 101 | + |
| 102 | +<img alt="Start recording" src="../images/start_recording.gif" width="500"/> |
| 103 | + |
| 104 | +* Do some interaction on your application |
| 105 | +* And stop the recording! |
| 106 | +* Now you will se all the calls on the just created recording! |
| 107 | + |
| 108 | +<img alt="Start recording" src="../images/calendar_recorded.gif" width="500"/> |
| 109 | + |
| 110 | +* "Download" the recording as "Sample.json" |
0 commit comments