Posts

Showing posts from June, 2016

Invoking RESTful WebServices Behind The Proxy

Types of proxy networks Invoke REST api calls behind the proxy using spring RestTemplate and using simple HTTPUrlConnection instance. You will learn how to make Third party RESTful apis calls or invoking your micro services which are deployed in different domain. What are additional properties that you need to set to make this rest calls beyond the proxy. This is useful when your organization network running beyond the proxy but you need to make the calls the external services from your application. Types of proxy networks SOCKS : This is general purpose proxy server that establishes a TCP connection to another server on behalf of the client, then routes all the traffic back and forth between the client and the server. It works any kind of protocol (SSH,WebSocket etc) and any port. SOCKS5 adds additional support for security and UDP. HTTP : Used to handle high level protocols such as HTTP or FTP. HTTP proxy used to handle HTTP traffic. Since our RESTful

Paho API (MQTT Client) with Mosquitto broker and Spring WebSocket

What is MQTT Protocol What is MQTT Protocol MQTT (Message Queuing Telemetry Transport) is a publish-subscribe based light weight messaging protocol which works on top of TCP/IP protocol. Like HTTP and WebSocket protocol this MQTT works on top of TCP/IP protocol. It is designed to establish communication among the devices without user intervention.Hence this protocol also called IoT protocol. as a java developer we all know that publish subscribers messaging model (JMS) requires a broker. When we works with asynchronous messaging we generally user ActiveMQ or RabitMQ kind of messaging brokers. Similarly MQTT also requires messaging broker. This broker is responsible for distributing messages to interested clients based on the topic of message. MQTT is a good choice for the wireless networks that experience varying levels of latency due to occasional bandwidth constraints or unreliable connections. In messaging world we will have two types of destinations.

Spring Mvc unit testing with Mockito

Create dummy services This guide walks you through the process of testing a simple web application FormController and RestController. Spring framework is more popular because of its IoC container and AOP framework. Similarly Junit is very popular framework to test the unit of code.But consider a scenario where your service code is dependent on some external service which are really works in the enterprise servers.and if you want to test your front end controllers or services without actually deploying your application into enterprise servers. This kind of testing is called integration testing. Create dummy services One approach is to test this kind of applications writing our own dummy services which return some dummy data.