Problem interfacing with created Software Serial

I have an Arduino Mega 2560, and I'm trying to create a test for it to test it's Software Serial. It would be similar to the echo test, but instead of using serial monitor I'm trying to use 2 Software Serials I created.

Here is my code:

#include <SoftwareSerial.h>
#define Tx1Pin 12
#define Rx1Pin 11
#define Tx2Pin 10
#define Rx2Pin 9
#define serial_baudrate 9600
SoftwareSerial serial1(Rx1Pin, Tx1Pin);
SoftwareSerial serial2(Rx2Pin, Tx2Pin);
int incomingByte = 0;
void setup(){
  pinMode(Rx1Pin, INPUT);
  digitalWrite(Tx1Pin, HIGH);
  pinMode(Tx1Pin, OUTPUT);
  pinMode(Rx1Pin, INPUT);
  digitalWrite(Tx2Pin, HIGH);
  pinMode(Tx2Pin, OUTPUT);
  Serial.begin(serial_baudrate);
  serial1.begin(serial_baudrate);
  serial2.begin(serial_baudrate);
  delay(1000);
}
void loop(){
  serial1.write("HelloWorld");
  delay(50);
  if (serial2.available() > 0) {
    incomingByte = serial2.read();
    Serial.println((char)incomingByte);
  }
  delay(50);
}

No matter what I do, the arduino always says that there is not bytes incoming. This is a brand new arduino mega, so that shouldn't be a problem. the wiring for it that I'm using is just a wire between pins 12 and 9, and a wire between 11 and 10. I've performed a regular echo test on the arduino and it passes just fine for regular serial monitor. The arduino is powered by the USB cord to my computer so that I can use serial monitor to check if the code is working. The code I put up there outputs nothing since it says that serial1 is never available. I've looked up other uses for software serial on the internet, and it seems like everyone else is doing the communication the same way my code should be doing it.

Can anyone tell me what I'm doing wrong here?

Perhaps you have hit one of the documented limitations:

Limitations

The library has the following known limitations:

If using multiple software serial ports, only one can receive data at a time.

Not all pins on the Mega and Mega 2560 support change interrupts, so only the following can be used for RX: 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69).

Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

I think I saw something like that earlier. I changed the code and the wiring so that I am only using pins 10-13. This gives me the same result though. No print, and it always says that there is nothing available.

You can try my new library and change "serial1" from SoftwareSerial to SoftwareSerialTX.
http://forum.arduino.cc/index.php?topic=188578.0

That way you're not doubling up on the interrupt handlers.

Note: You have to use the baud rate constants (SoftwareSerialTX.BAUD_9600) for the constructor.

Thanks for the suggestion, I've seen NewSoftSerial, but not SoftSerialTX. I downloaded the zip file for the SoftSerialTX library and copied it into the Arduino Libraries. This is my new code to use the SoftSerialTX Library. I ran it with no errors, but it still results in not printing anything.
Code:

#include <SoftwareSerial.h>
#include <SoftwareSerialTX.h>
#define Tx1Pin 12
#define Rx1Pin 11
#define Tx2Pin 13
#define Rx2Pin 10
#define serial_baudrate 9600
SoftwareSerialTX serial1(SoftwareSerialTX::BAUD_9600, Tx1Pin);
SoftwareSerial serial2(Rx2Pin, Tx2Pin);
int incomingByte = 0;
void setup(){
  pinMode(Rx1Pin, INPUT);
  digitalWrite(Tx1Pin, HIGH);
  pinMode(Tx1Pin, OUTPUT);
  pinMode(Rx1Pin, INPUT);
  digitalWrite(Tx2Pin, HIGH);
  pinMode(Tx2Pin, OUTPUT);
  Serial.begin(serial_baudrate);
  serial2.begin(serial_baudrate);
  delay(1000);
}
void loop(){
  serial1.write("HelloWorld");
  delay(50);
  if (serial2.available() > 0) {
    incomingByte = serial2.read();
    Serial.println((char)incomingByte);
  }
  delay(50);
}

No matter what I do, the arduino always says that there is not bytes incoming.

No mention of what is connected to the software serial instance's pins. Why not?

  serial1.write("HelloWorld");

This makes the serial1 instance the active instance.

  if (serial2.available() > 0) {
    incomingByte = serial2.read();

Nothing heard by the inactive instance. Gee, I wonder why. It isn't listening!

In my original post it says that I just have one wire connected between pin 13 and pin 11, and another wire connected between pin 12 and pin 10. If you're saying that I need to insert

serial2.listen();

before my if statement, then I'd tell you that I have already tried that. It results in the arduino still saying that there is no bytes available, even though serial2 is listening.

If you're saying that I need to insert...before my if statement, then I'd tell you that I have already tried that. It results in the arduino still saying that there is no bytes available, even though serial2 is listening.

But, does the data arrive while you are listening? Or, does loop() and, restart, and switch to the other instance because you write() using that instance?

Why are you using SoftwareSerial for a loop back test on a device with 4 hardware serial ports?

So the serial2.listen should actually go before I start writing with serial1? That makes sense. I just tried it though, and it still didn't work.

I am using software serial because I am working on a project that uses a Micro Maestro 6-Channel USB Servo Controller that is controlled by the Arduino Mega. Currently I am able to send the Maestro commands to move a servo, and to set it's speed and acceleration. I am not able though to receive any data back from the Maestro though. I measured the signals from both the Arduino and the Maestro, so the only problem is that the arduino is not receiving the signal that the Maestro is sending. I'm using this artificial loop back test to ensure that my arduino is able to receive and process signals.

So the serial2.listen should actually go before I start writing with serial1?

No. You really can't use two instances of SoftwareSerial the way you are trying to. There is just no way.

I'm using this artificial loop back test to ensure that my arduino is able to receive and process signals.

This is not an explanation of why you are not using two hardware serial ports or two software instances on different machines. Either would work. Two software serial instances on one machine will never work.