TCP connection limiting

Hi Everyone,

I want to limit TCP connections to a server from client side. Let’s say my server accepts only 5 concurrent TCP connections.

Currently it’s done using Java Semaphore with Threads but I want to explore other solutions like API Gateways or proxy.

Thanks in advance