Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6726875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:58:52+00:00 2026-05-26T09:58:52+00:00

I am developing a Java library for communication via HTTP, and I want to

  • 0

I am developing a Java library for communication via HTTP, and I want to test its reliability and performance in case of network problems such as packet loss, high latency, low bandwidth, and congestion. I’m using Apache’s httpclient library for doing connections from client side, and Java’s own com.sun.net.httpserver.HttpServer for starting up HTTP servers.

Are there libraries available that do that kind of thing, or should I roll my own? I guess I could try to plug my own org.apache.http.conn.scheme.SchemeSocketFactory into the client side, and simulate several of the problems mentioned above with that, but I’d prefer to use something that works already 🙂

This is similar to question Creating TCP network errors for unit testing, but I’m looking for solutions involving Java on Linux. I’ve looked at click, which was suggested for that question, but I’m not sure it can provide what I’m looking for.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:58:52+00:00Added an answer on May 26, 2026 at 9:58 am

    Since Java API’s do not have access to the low level network API’s, emulating it would be challenging.

    Alternatively The Apache HTTP Core components library may have something to help you simulate latency and data loss and possibly bandwidth issues. The library has the feature to inject your own session input and output buffers. You can find the documentation at Advanced Features of HTTP Core

    By injecting your own buffer

    • Latency can be a small delay injected into the read and writes
    • Data loss is some bytes thrown away. It is not packet loss in the true sense, since there is no resending of duplicates.
    • Bandwidth can be limited by tuning the read/write and flush operations.
    • Traffic is hard to simulate except as an over all slowdown of reading and writing to the buffer.

    You can also look at TCPProxy available in the Grinder project. I haven’t looked at it in detail. The documentation shows EchoFilter as an example but I believe it should be possible to extend the filters to delay the sending and receiving of bytes within the stream. But it makes sense to use a proxy to simulate network issues. This way your client and server remain blissfully ignorant of the testing going on.

    In both cases simulation of the network issues seems to be the best effort possible in Java.
    Or else you can setup a local firewall and have it configured to intercept and play with the packets it receives.

    Hope this was helpfull.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a Java library that provides functionality for developing social network applications such
I'm currently developing a Java-based library for network coding (http://en.wikipedia.org/wiki/Network_coding). This is very CPU-intensive
i am developing a GUI , using java Swing library .I want to add
i'm developing a java application using the jstun library (hxxp://jstun.javawi.de/), and i need to
I´m developing a Java solution for manage an iTunes Library (ITL file). The ITL
I am developing a small application in Java. I am using Java2D Library for
I'm developing a wrapper for a C/C++ library in Java, and it's gotten to
I'm developing a C++ library. It got me thinking of the ways Java and
I'm developing Swing based application in Java I want a executable JAR file for
I am developing a domain-specific application library in Java and C#. I'd like suggestions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.