# How Java communicates with ziti

**URL:** <https://openziti.discourse.group/t/how-java-communicates-with-ziti/440>\
**Category:** Uncategorized\
**Created:** [April 26, 2022, 7:56am UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440 "2022-04-26T07:56:52Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sevarac](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sevarac](https://openziti.discourse.group/u/sevarac)\
**Post date:** [April 26, 2022, 7:56am UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440/1 "2022-04-26T07:56:52Z")

</div>

How Java actually communicates with open ziti?  
In [ziti-sdk-jvm/HttpSample.java at main · openziti/ziti-sdk-jvm · GitHub](https://github.com/openziti/ziti-sdk-jvm/blob/main/samples/http-sample/src/main/java/org/openziti/sample/http/HttpSample.java)  
there is only call to Ziti.init(args[0], “”.toCharArray(), true) and after that using plain HttpURLConnection

---

<div class="post-metadata">

**Author:** ![markamind](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/markamind/32/157_2.png) [@markamind](https://openziti.discourse.group/u/markamind)\
**Post date:** [April 26, 2022, 8:40am UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440/2 "2022-04-26T08:40:53Z")

</div>

Took a quick look… I will aim to give you a brief heads up but are not a java developer.

I think the best way to start is to think about it this way.

Rather than calling a http listener service… you dial a zitified method.

When you dial a zitified method… you pass in two parameters

#1. json token for the identity after you have enrolled it  
#2. service that you want to dial

Once you have this done… then everything should just work the same… its just that its going over a ziti network mesh… rather than… over a public dns…

Hope that makes sense.

---

<div class="post-metadata">

**Author:** ![TheLumberjack](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/thelumberjack/32/113_2.png) [@TheLumberjack](https://openziti.discourse.group/u/TheLumberjack)\
**Post date:** [April 26, 2022, 1:22pm UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440/3 "2022-04-26T13:22:31Z")

</div>

@markamind makes some good comments. @sevarac - just how deeply do you want to get into this? 🙂 I saw your other/first post and just commented on it. It might show you enough for what you want to do.

Really what happens is either you simple creat a secure connection to the other side (which is the ‘magic’ that ziti does for you) and you just write the bytes you want to write (or read) or the JRE is instrumented by the ziti SDK and learns how to “intercept” addresses on your behalf.

Your question is a big vague though. If you could maybe narrow down the actual question, I could hopefully provide a better answer

---

<div class="post-metadata">

**Author:** ![ekoby](https://yyz2.discourse-cdn.com/free1/user_avatar/openziti.discourse.group/ekoby/32/14_2.png) [@ekoby](https://openziti.discourse.group/u/ekoby)\
**Post date:** [April 26, 2022, 2:30pm UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440/4 "2022-04-26T14:30:51Z")

</div>

When you initialize Ziti SDK in _seamless_ mode (last parameter in the init call) it injects overlay socket implementation into Java internals. So when URLConnection initializes network connection it will actually get the overlay connection to a Ziti service.

---

<div class="post-metadata">

**Author:** ![sevarac](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@sevarac](https://openziti.discourse.group/u/sevarac)\
**Post date:** [April 29, 2022, 11:43am UTC](https://openziti.discourse.group/t/how-java-communicates-with-ziti/440/5 "2022-04-29T11:43:11Z")

</div>

Thanks for all the answers.  
@ekoby explained what I was wondering
