From 48d7f4969c7e191e170631027d68b6ed24819af9 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 27 Nov 2015 16:20:49 +0000
Subject: [PATCH] Fix PROTOCOL parsing Add PROTOCOL test for raw sessions to
 send client

---
 apps/sam/java/src/net/i2p/sam/SAMv3DatagramServer.java  | 2 +-
 apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/apps/sam/java/src/net/i2p/sam/SAMv3DatagramServer.java b/apps/sam/java/src/net/i2p/sam/SAMv3DatagramServer.java
index 64202c51e4..a482318fa6 100644
--- a/apps/sam/java/src/net/i2p/sam/SAMv3DatagramServer.java
+++ b/apps/sam/java/src/net/i2p/sam/SAMv3DatagramServer.java
@@ -158,7 +158,7 @@ class SAMv3DatagramServer implements Handler {
 					while (tok.hasMoreTokens()) {
 						String t = tok.nextToken();
 						if (t.startsWith("PROTOCOL="))
-							pr = t.substring("PROTOTCOL=".length());
+							pr = t.substring("PROTOCOL=".length());
 						else if (t.startsWith("FROM_PORT="))
 							fp = t.substring("FROM_PORT=".length());
 						else if (t.startsWith("TO_PORT="))
diff --git a/apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java b/apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java
index 7b53429b93..90cbd09001 100644
--- a/apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java
+++ b/apps/sam/java/src/net/i2p/sam/client/SAMStreamSend.java
@@ -440,7 +440,10 @@ public class SAMStreamSend {
                             baos.write(DataHelper.getASCII(_remoteDestination));
                             if (_isV32) {
                                 // only set TO_PORT to test session setting of FROM_PORT
-                                baos.write(DataHelper.getASCII(" TO_PORT=5678"));
+                                if (_mode == RAW)
+                                    baos.write(DataHelper.getASCII(" PROTOCOL=123 TO_PORT=5678"));
+                                else
+                                    baos.write(DataHelper.getASCII(" TO_PORT=5678"));
                             }
                             baos.write((byte) '\n');
                             baos.write(data, 0, read);
-- 
GitLab