Visit http://www.smocker.org/
Smocker is an open source software allowing you to watch an mock all the network interactions made by your java application via a Rich Web application. You can easily discover how your java application deals with external network dependencies.
Then stub external networks dependencies to isolate you application and test all kind of behaviors of external systems.
All virtualization service tools are acting as proxy, recording and stubbing request and response are going through the proxy.
Smocker agent is different, it is directly embedded inside the JVM, no configuration change is needed to sniff and mock the network interactions.
Classic virtualization tools needs dedicated port for each external system. Smocker watch every thing, in example both backend and database connections can be virtualized in the same place.
Scripting is available in both Java and Javascript languages. any kind of TCP protocol can then be implemented.
![](https://raw.githubusercontent.com/igolus/smocker/master/Docs/images/smockerHighLevel2 (1).jpg)]()
Smocker is divided in two part :
- The client Use javassist to decorate java socket layer allowing sniffing and stubbing network communications
- A web application running in a Wildfly server.
- GUI is built using vaadin framework and Rest services.
- J2V8 is used to allow programmatic interaction.
- download and install WildFly
- A customized version is available @ http://www.smocker.org/
- Java8
- Maven
Fork the repo and clone it.
run mvn install in root folder.
find jar for the client in smockerAgent1.7\target
find war for wild fly in C:\java\git_clones\smocker\smockerVaadin\target
Let’s create environment variable to define the smocker client java argument line.
First define SMOCKER_CLIENT_HOME targeting the place where the client is installed
Then define the SMOCKER_JAVA_ARGS environment variable.
Here is the value to define
-Xbootclasspath/a:%SMOCKER_CLIENT_HOME%/javassist.jar;%SMOCKER_CLIENT_HOME%/smockerAgent1.7-1.0-SNAPSHOT.jar -javaagent:%SMOCKER_CLIENT_HOME%/smockerAgent1.7-1.0-SNAPSHOT.jar -Djava.util.logging.SimpleFormatter.format="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$-6s %2$s %5$s%6$s%n"
Then add java program you want to smock: java %SMOCKER_JAVA_ARGS% ....
Download the server part here
Adapt the [Install Folder]/bin/standalone.bat or standalone.sh to set your Java Home (if needed)
Simply run standalone.bat or standalone.sh in [Smocker_Server]\wildfly-13.0.0.Final-Smocker\bin folder.
docker pull igolus/smocker
docker run -p 8080:8080 igolus/smocker
Use firefox to browse http://localhost:8080/smocker/
Smocker use Apache License 2.0