Skip to content

Latest commit

 

History

History
57 lines (39 loc) · 3.48 KB

File metadata and controls

57 lines (39 loc) · 3.48 KB
title Azure Relay Hybrid Connections - HTTP requests in Java
description Write a Java console application for Azure Relay Hybrid Connections HTTP requests.
ms.topic tutorial
ms.date 01/24/2026
ms.custom devx-track-java, mode-ui, mode-api, devx-track-extended-java

Get started with Relay Hybrid Connections HTTP requests in Java

[!INCLUDE relay-selector-hybrid-connections]

In this quickstart, you create Java sender and receiver applications that send and receive messages by using the HTTP protocol. The applications use Hybrid Connections feature of Azure Relay. To learn about Azure Relay in general, see Azure Relay.

In this quickstart, you take the following steps:

  1. Create a Relay namespace by using the Azure portal.
  2. Create a hybrid connection in that namespace by using the Azure portal.
  3. Write a server (listener) console application to receive messages.
  4. Write a client (sender) console application to send messages.
  5. Run applications.

Prerequisites

Create a namespace using the Azure portal

[!INCLUDE relay-create-namespace-portal]

Create a hybrid connection using the Azure portal

[!INCLUDE relay-create-hybrid-connection-portal]

Create a server application (listener)

To listen and receive messages from the Relay, write a Java console application.

[!INCLUDE relay-hybrid-connections-java-get-started-server]

Create a client application (sender)

To send messages to the Relay, you can use any HTTP client, or write a Java console application.

[!INCLUDE relay-hybrid-connections-java-get-started-client]

Run the applications

  1. Run the server application: from a Java command prompt or application type java -cp <jar_dependency_path> com.example.listener.Listener.java.
  2. Run the client application: from a Java command prompt or application type java -cp <jar_dependency_path> com.example.sender.Sender.java, and enter some text.
  3. Ensure that the server application console outputs the text that was entered in the client application.

Congratulations, you have created an end-to-end Hybrid Connections application using Java!

Next steps

In this quickstart, you created Java client and server applications that used HTTP to send and receive messages. The Hybrid Connections feature of Azure Relay also supports using WebSockets to send and receive messages. To learn how to use WebSockets with Azure Relay Hybrid Connections, see the WebSockets quickstart.

In this quickstart, you used Java to create client and server applications. To learn how to write client and server applications using .NET Framework, see the .NET WebSockets quickstart or the .NET HTTP quickstart.