Mocking ModemManager for dbus golang client - go

I have an go program that config wwan network connection using ModemManager over D-Bus. It uses this library: https://github.com/godbus/dbus. I want to write tests for my application so I need to mock ModemManager somehow. I think that best way to do it is to create peer to peer connection and run mock ModemManager server on the other side of this connection.
How to do it?

Look at using python-dbusmock, though you will need to write a ModemManager template for it since it doesn’t have one already.

Related

how to run grpc client in python and server in cpp?

I am trying to work with client.py , server.cpp and a make file. I am not understanding how to run the files and work on grpc with these files. Is it possible for anyone to help me understand this concept and work with the client, server and protobuf?
The whole idea of gRPC is to enable protocol based communication between cross platform services. Means your CPP server can communicate with python client. Ref: Official gRPC Documentation
First step is to write a .proto file which is an agreement between server and client on what attributes should a request / response for a particular RPC method should contain.
Now one can implement server, client in any language of their choice. As long as server & client agree on single proto file, underlying process is abstracted by gRPC framework and it just works!!!
For fastest hands-on, Refer to quick start guides of gRPC for c++, python to implement cross platform server, client.

are there any implementations of coap-http or mqtt-http cross proxies available which can process thing descriptions?

I am using the node-wot browser library and I would like to connect IoT-devices communicating via MQTT and CoAP to the browser. As the browser/ library is not capable of communicating via MQTT or CoAP, are there any implementations of HTTP-CoAP or HTTP-MQTT proxies available which can process thing descriptions?
The idea would be to have a proxy where I could connect my device to, simply by providing a w3c wot thing description. Ideally the proxy would create another thing description which I could use to connect the browser to the proxy via HTTP.
You can check out the shadow-thing project for an existing implementation but it is rather easy to this yourself with node-wot:
Fetch the TD of the Thing you want to proxy and consume it to create a consumed thing.
Take that TD and put it into the produce() method.
Add handlers for all the affordances
In each handler make the appropriate call to the consumed Thing.
Resolve the messages you get via your exposed Thing so that they are returned to your consumer.
For me the requirements are not that clear.
The open source project Eclispe/Californium comes with coap2http cross proxy functionality (and also http2coap). You may try it demo-apps/cf-proxy2

TLS-PSK over TOR python

I am currently trying to create a "TOR version" of a service I created, running with TLS. I want to perform mutual authentication of both parties ; client and server.
I thought about using TLS-PSK over TOR, which would gives me the properties I desire, especially eavesdropping prevention.
I wanted to use the socket library and to double wrap a socket instance using first the ssl library then to do the same thing with TOR, but it looks like there is no library existing allowing me to do the second wrapping.
Do you have any idea about existing libraries allowing me to do something like that ?

How can I connect to sockJS from a client written in Go?

I have a server that uses websockets. It is written in Go. For testing, I have another application written in Go. To test, I start the server, then run the test client. The test client creates websocket connections to the server and does things (basically impersonating user activity). Both the client and the server are using the gorilla/websockets library, and standard browsers also work fine with the server.
This was all working beautifully.
To support non-compliant browsers, I was asked to start using the SockJS Go server library. I did this and the new version works just fine when used from a browser by clients using the SockJS library.
Now for the problem. SockJS does not accept incoming websocket connections. Only connections from the SockJS client. So my testing application doesn't work, and I'm unable to test.
I could recover the old version of my connection code from git and make a separate connection type that uses gorilla/websockets and have my server listen on an additional port that only listens on localhost. This would allow me to test the functionality. The downside is that I have to maintain two versions of essentially the same code, and I wouldn't be testing the real user experience and possibly not find bugs until production.
Ideally the SockJS server, considering it still uses gorilla/websockets as a dependency would automatically accept proper websocket connections, but barring that it seems I'd need a SockJS client library in Go which, as far as I can tell, doesn't exist.
Does anyone have a solution for this? Thanks!

Starting a jms Connection with standalone MQ Clientdriver

I want to check if a JMS-Connection to a remote queuing is working. As this should be kind of J-Unit Test I can't use a Server (in my case would be Websphere. Is there any driver implementation or API I could use to initialize the connection ?
No; without a backend Queuemanager there's nothing to respond to the connection. Messaging is inherently a distributed / networked product. There isn't something like a 'mock' QueueManager. In order for the connection to be properly created the mock would need to implement a lot of real function.

Resources