added method for sending packets and added a test case