Hello,
I want to create a Tcp proxy with Camel and deploy this proxy into
ServiceMix.
http://camel.465427.n5.nabble.com/file/n4560390/Untitled.png 
Let the Tcp Client invoke Servicemix(Tcp Proxy), and ServiceMix(Tcp Proxy)
can route the message to Tcp Server.
Now I have completed the Tcp client and Tcp Server, which are both made in
java project. and run TCPClient class can invoke TCPServer class without
ServiceMix.
Now I need to create a Tcp proxy  between Tcp Client and Tcp Server, which
would be deployed into ServiceMix.

1.
//Tcp Client code
class TCPClient
{
         public static void main(String argv[]) throws Exception
         {
                  String sentence;
                  String modifiedSentence;
                  BufferedReader inFromUser = new BufferedReader( new
InputStreamReader(System.in));
                  Socket clientSocket = new Socket("localhost", 6789);
                  DataOutputStream outToServer = new
DataOutputStream(clientSocket.getOutputStream());
                  BufferedReader inFromServer = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
                  sentence = inFromUser.readLine();
                  outToServer.writeBytes(sentence + '\n');
                  modifiedSentence = inFromServer.readLine();
                  System.out.println("FROM SERVER: " + modifiedSentence);
                  clientSocket.close();
         }
}

2.
//Tcp Client code
class TCPServer
{
   public static void main(String argv[]) throws Exception
      {
         String clientSentence;
         String capitalizedSentence;
         ServerSocket welcomeSocket = new ServerSocket(6789);

         while(true)
         {
            Socket connectionSocket = welcomeSocket.accept();
            BufferedReader inFromClient = new BufferedReader(new
InputStreamReader(connectionSocket.getInputStream()));
            DataOutputStream outToClient = new
DataOutputStream(connectionSocket.getOutputStream());
            clientSentence = inFromClient.readLine();
            System.out.println("Received: " + clientSentence);
            capitalizedSentence = clientSentence.toUpperCase() + '\n';
            outToClient.writeBytes(capitalizedSentence);
         }
      }
}

Could you tell me how to create this Tcp proxy in detail ?

Thank you !!! 

--
View this message in context: 
http://camel.465427.n5.nabble.com/tcp-proxy-route-tp4332461p4560390.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to