Updated all arrays after merge of #3846
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
5568f833e7
commit
9fe27eb8e3
|
@ -59,7 +59,7 @@ public class CookieCutterTest
|
||||||
{
|
{
|
||||||
String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"";
|
String rawCookie = "$Version=\"1\"; Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(1));
|
assertThat("Cookies.length", cookies.length, is(1));
|
||||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||||
|
@ -75,7 +75,7 @@ public class CookieCutterTest
|
||||||
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
"Customer=\"WILE_E_COYOTE\"; $Path=\"/acme\"; " +
|
||||||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(2));
|
assertThat("Cookies.length", cookies.length, is(2));
|
||||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||||
|
@ -93,7 +93,7 @@ public class CookieCutterTest
|
||||||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"; " +
|
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"; " +
|
||||||
"Shipping=\"FedEx\"; $Path=\"/acme\"";
|
"Shipping=\"FedEx\"; $Path=\"/acme\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(3));
|
assertThat("Cookies.length", cookies.length, is(3));
|
||||||
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
assertCookie("Cookies[0]", cookies[0], "Customer", "WILE_E_COYOTE", 1, "/acme");
|
||||||
|
@ -111,7 +111,7 @@ public class CookieCutterTest
|
||||||
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
|
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
|
||||||
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(2));
|
assertThat("Cookies.length", cookies.length, is(2));
|
||||||
assertCookie("Cookies[0]", cookies[0], "Part_Number", "Riding_Rocket_0023", 1, "/acme/ammo");
|
assertCookie("Cookies[0]", cookies[0], "Part_Number", "Riding_Rocket_0023", 1, "/acme/ammo");
|
||||||
|
@ -128,7 +128,7 @@ public class CookieCutterTest
|
||||||
"session_id=\"1234\"; " +
|
"session_id=\"1234\"; " +
|
||||||
"session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
"session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(2));
|
assertThat("Cookies.length", cookies.length, is(2));
|
||||||
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
||||||
|
@ -144,7 +144,7 @@ public class CookieCutterTest
|
||||||
String rawCookie = "$Version=\"1\"; session_id=\"1234\", " +
|
String rawCookie = "$Version=\"1\"; session_id=\"1234\", " +
|
||||||
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC2965, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(2));
|
assertThat("Cookies.length", cookies.length, is(2));
|
||||||
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
assertCookie("Cookies[0]", cookies[0], "session_id", "1234", 1, null);
|
||||||
|
@ -164,7 +164,7 @@ public class CookieCutterTest
|
||||||
{
|
{
|
||||||
String rawCookie = "SID=31d4d96e407aad42";
|
String rawCookie = "SID=31d4d96e407aad42";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(1));
|
assertThat("Cookies.length", cookies.length, is(1));
|
||||||
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
||||||
|
@ -178,7 +178,7 @@ public class CookieCutterTest
|
||||||
{
|
{
|
||||||
String rawCookie = "SID=31d4d96e407aad42; lang=en-US";
|
String rawCookie = "SID=31d4d96e407aad42; lang=en-US";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(2));
|
assertThat("Cookies.length", cookies.length, is(2));
|
||||||
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
assertCookie("Cookies[0]", cookies[0], "SID", "31d4d96e407aad42", 0, null);
|
||||||
|
@ -193,7 +193,7 @@ public class CookieCutterTest
|
||||||
{
|
{
|
||||||
String rawCookie = "key=value";
|
String rawCookie = "key=value";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(1));
|
assertThat("Cookies.length", cookies.length, is(1));
|
||||||
assertCookie("Cookies[0]", cookies[0], "key", "value", 0, null);
|
assertCookie("Cookies[0]", cookies[0], "key", "value", 0, null);
|
||||||
|
@ -207,7 +207,7 @@ public class CookieCutterTest
|
||||||
{
|
{
|
||||||
String rawCookie = "$key=value";
|
String rawCookie = "$key=value";
|
||||||
|
|
||||||
Cookie cookies[] = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
Cookie[] cookies = parseCookieHeaders(CookieCompliance.RFC6265, rawCookie);
|
||||||
|
|
||||||
assertThat("Cookies.length", cookies.length, is(0));
|
assertThat("Cookies.length", cookies.length, is(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class GzipTester
|
||||||
digester = new DigestOutputStream(uncompressedStream, digest);
|
digester = new DigestOutputStream(uncompressedStream, digest);
|
||||||
IO.copy(in, digester);
|
IO.copy(in, digester);
|
||||||
|
|
||||||
byte output[] = uncompressedStream.toByteArray();
|
byte[] output = uncompressedStream.toByteArray();
|
||||||
String actualSha1Sum = Hex.asHex(digest.digest());
|
String actualSha1Sum = Hex.asHex(digest.digest());
|
||||||
return new ContentMetadata(output.length, actualSha1Sum);
|
return new ContentMetadata(output.length, actualSha1Sum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public final class Hex
|
||||||
throw new IllegalArgumentException(String.format("Invalid ID length of <%d> expected range of <0> to <%d>", id.length(), (size * 2)));
|
throw new IllegalArgumentException(String.format("Invalid ID length of <%d> expected range of <0> to <%d>", id.length(), (size * 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte buf[] = new byte[size];
|
byte[] buf = new byte[size];
|
||||||
byte hex;
|
byte hex;
|
||||||
int len = id.length();
|
int len = id.length();
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public final class Hex
|
||||||
public static String asHex(byte buf[])
|
public static String asHex(byte buf[])
|
||||||
{
|
{
|
||||||
int len = buf.length;
|
int len = buf.length;
|
||||||
char out[] = new char[len * 2];
|
char[] out = new char[len * 2];
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
out[i * 2] = hexcodes[(buf[i] & 0xF0) >> 4];
|
out[i * 2] = hexcodes[(buf[i] & 0xF0) >> 4];
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class MessageWriterTest
|
||||||
FrameCapture capture = new FrameCapture();
|
FrameCapture capture = new FrameCapture();
|
||||||
try (MessageWriter writer = new MessageWriter(capture, 1024))
|
try (MessageWriter writer = new MessageWriter(capture, 1024))
|
||||||
{
|
{
|
||||||
char cbuf[] = new char[512];
|
char[] cbuf = new char[512];
|
||||||
Arrays.fill(cbuf, 'x');
|
Arrays.fill(cbuf, 'x');
|
||||||
writer.write(cbuf);
|
writer.write(cbuf);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ public class MessageWriterTest
|
||||||
FrameCapture capture = new FrameCapture();
|
FrameCapture capture = new FrameCapture();
|
||||||
try (MessageWriter writer = new MessageWriter(capture, 1024))
|
try (MessageWriter writer = new MessageWriter(capture, 1024))
|
||||||
{
|
{
|
||||||
char cbuf[] = new char[1024 * 2];
|
char[] cbuf = new char[1024 * 2];
|
||||||
Arrays.fill(cbuf, 'x');
|
Arrays.fill(cbuf, 'x');
|
||||||
writer.write(cbuf);
|
writer.write(cbuf);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public class MessageWriterTest
|
||||||
FrameCapture capture = new FrameCapture();
|
FrameCapture capture = new FrameCapture();
|
||||||
try (MessageWriter writer = new MessageWriter(capture, writerBufferSize))
|
try (MessageWriter writer = new MessageWriter(capture, writerBufferSize))
|
||||||
{
|
{
|
||||||
char cbuf[] = new char[testSize];
|
char[] cbuf = new char[testSize];
|
||||||
Arrays.fill(cbuf, 'x');
|
Arrays.fill(cbuf, 'x');
|
||||||
int remaining = cbuf.length;
|
int remaining = cbuf.length;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
@ -127,7 +127,7 @@ public class MessageWriterTest
|
||||||
WholeMessageCapture capture = new WholeMessageCapture();
|
WholeMessageCapture capture = new WholeMessageCapture();
|
||||||
try (MessageWriter writer = new MessageWriter(capture, writerBufferSize))
|
try (MessageWriter writer = new MessageWriter(capture, writerBufferSize))
|
||||||
{
|
{
|
||||||
char cbuf[] = new char[testSize];
|
char[] cbuf = new char[testSize];
|
||||||
Arrays.fill(cbuf, 'x');
|
Arrays.fill(cbuf, 'x');
|
||||||
for (int i = 0; i < testSize; i++)
|
for (int i = 0; i < testSize; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method2 = ReflectUtils.findMethod(KeyValue.class, "onEntry", int.class, String.class);
|
Method method2 = ReflectUtils.findMethod(KeyValue.class, "onEntry", int.class, String.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
};
|
};
|
||||||
|
@ -182,7 +182,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
};
|
};
|
||||||
|
@ -199,7 +199,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class),
|
new InvokerUtils.Arg(int.class),
|
||||||
new InvokerUtils.Arg(Boolean.class)
|
new InvokerUtils.Arg(Boolean.class)
|
||||||
|
@ -217,7 +217,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(Long.class),
|
new InvokerUtils.Arg(Long.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
|
@ -235,7 +235,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(Simple.class),
|
new InvokerUtils.Arg(Simple.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
|
@ -253,7 +253,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(Simple.class),
|
new InvokerUtils.Arg(Simple.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(Boolean.class),
|
new InvokerUtils.Arg(Boolean.class),
|
||||||
|
@ -273,7 +273,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class, "fruit"),
|
new InvokerUtils.Arg(String.class, "fruit"),
|
||||||
new InvokerUtils.Arg(String.class, "color"),
|
new InvokerUtils.Arg(String.class, "color"),
|
||||||
new InvokerUtils.Arg(int.class, "cost")
|
new InvokerUtils.Arg(int.class, "cost")
|
||||||
|
@ -291,7 +291,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(int.class, "cost"),
|
new InvokerUtils.Arg(int.class, "cost"),
|
||||||
new InvokerUtils.Arg(String.class, "fruit"),
|
new InvokerUtils.Arg(String.class, "fruit"),
|
||||||
new InvokerUtils.Arg(String.class, "color")
|
new InvokerUtils.Arg(String.class, "color")
|
||||||
|
@ -310,7 +310,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{};
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{};
|
||||||
|
|
||||||
MethodHandle methodHandle = InvokerUtils.mutatedInvoker(SampleSignatures.class, method, callingArgs);
|
MethodHandle methodHandle = InvokerUtils.mutatedInvoker(SampleSignatures.class, method, callingArgs);
|
||||||
String result = (String)methodHandle.invoke(samples);
|
String result = (String)methodHandle.invoke(samples);
|
||||||
|
@ -323,7 +323,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -384,7 +384,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -400,7 +400,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStrFile");
|
Method method = findMethodByName(samples, "sigStrFile");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -416,7 +416,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStrFile");
|
Method method = findMethodByName(samples, "sigStrFile");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -432,7 +432,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStr");
|
Method method = findMethodByName(samples, "sigFileStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -448,7 +448,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStr");
|
Method method = findMethodByName(samples, "sigFileStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -464,7 +464,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(boolean.class, "fin")
|
new InvokerUtils.Arg(boolean.class, "fin")
|
||||||
|
@ -481,7 +481,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(boolean.class)
|
new InvokerUtils.Arg(boolean.class)
|
||||||
|
@ -498,7 +498,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class, "fin"),
|
new InvokerUtils.Arg(boolean.class, "fin"),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
@ -515,7 +515,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class),
|
new InvokerUtils.Arg(boolean.class),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
@ -532,7 +532,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class, "fin"),
|
new InvokerUtils.Arg(boolean.class, "fin"),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class InvokerUtils_StaticParamsTest
|
||||||
Method method = ReflectUtils.findMethod(Foo.class, "onFruit", String.class);
|
Method method = ReflectUtils.findMethod(Foo.class, "onFruit", String.class);
|
||||||
|
|
||||||
// Declared Variable Names
|
// Declared Variable Names
|
||||||
final String namedVariables[] = new String[]{
|
final String[] namedVariables = new String[]{
|
||||||
"fruit"
|
"fruit"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ public class InvokerUtils_StaticParamsTest
|
||||||
Method method = ReflectUtils.findMethod(Foo.class, "onCount", int.class);
|
Method method = ReflectUtils.findMethod(Foo.class, "onCount", int.class);
|
||||||
|
|
||||||
// Declared Variable Names - as seen in url-template-pattern
|
// Declared Variable Names - as seen in url-template-pattern
|
||||||
final String namedVariables[] = new String[]{
|
final String[] namedVariables = new String[]{
|
||||||
"count"
|
"count"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ public class InvokerUtils_StaticParamsTest
|
||||||
Method method = ReflectUtils.findMethod(Foo.class, "onLabeledCount", String.class, int.class);
|
Method method = ReflectUtils.findMethod(Foo.class, "onLabeledCount", String.class, int.class);
|
||||||
|
|
||||||
// Declared Variable Names - as seen in url-template-pattern
|
// Declared Variable Names - as seen in url-template-pattern
|
||||||
final String namedVariables[] = new String[]{
|
final String[] namedVariables = new String[]{
|
||||||
"count"
|
"count"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class NameParamIdentifier implements InvokerUtils.ParamIdentifier
|
||||||
@Override
|
@Override
|
||||||
public InvokerUtils.Arg getParamArg(Method method, Class<?> paramType, int idx)
|
public InvokerUtils.Arg getParamArg(Method method, Class<?> paramType, int idx)
|
||||||
{
|
{
|
||||||
Annotation annos[] = method.getParameterAnnotations()[idx];
|
Annotation[] annos = method.getParameterAnnotations()[idx];
|
||||||
if (annos != null || (annos.length > 0))
|
if (annos != null || (annos.length > 0))
|
||||||
{
|
{
|
||||||
for (Annotation anno : annos)
|
for (Annotation anno : annos)
|
||||||
|
|
|
@ -55,9 +55,9 @@ public class JsrBrowserSocket
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
||||||
int lettersLen = letters.length;
|
int lettersLen = letters.length;
|
||||||
char randomText[] = new char[size];
|
char[] randomText = new char[size];
|
||||||
Random rand = new Random(42);
|
Random rand = new Random(42);
|
||||||
String msg;
|
String msg;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public class JsrBrowserSocket
|
||||||
}
|
}
|
||||||
case "many":
|
case "many":
|
||||||
{
|
{
|
||||||
String parts[] = StringUtil.csvSplit(val);
|
String[] parts = StringUtil.csvSplit(val);
|
||||||
int size = Integer.parseInt(parts[0]);
|
int size = Integer.parseInt(parts[0]);
|
||||||
int count = Integer.parseInt(parts[1]);
|
int count = Integer.parseInt(parts[1]);
|
||||||
|
|
||||||
|
@ -150,12 +150,12 @@ public class JsrBrowserSocket
|
||||||
}
|
}
|
||||||
case "manythreads":
|
case "manythreads":
|
||||||
{
|
{
|
||||||
String parts[] = StringUtil.csvSplit(val);
|
String[] parts = StringUtil.csvSplit(val);
|
||||||
int threadCount = Integer.parseInt(parts[0]);
|
int threadCount = Integer.parseInt(parts[0]);
|
||||||
int size = Integer.parseInt(parts[1]);
|
int size = Integer.parseInt(parts[1]);
|
||||||
int count = Integer.parseInt(parts[2]);
|
int count = Integer.parseInt(parts[2]);
|
||||||
|
|
||||||
Thread threads[] = new Thread[threadCount];
|
Thread[] threads = new Thread[threadCount];
|
||||||
|
|
||||||
// Setup threads
|
// Setup threads
|
||||||
for (int n = 0; n < threadCount; n++)
|
for (int n = 0; n < threadCount; n++)
|
||||||
|
@ -194,9 +194,9 @@ public class JsrBrowserSocket
|
||||||
|
|
||||||
private void writeManyAsync(int size, int count)
|
private void writeManyAsync(int size, int count)
|
||||||
{
|
{
|
||||||
char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
||||||
int lettersLen = letters.length;
|
int lettersLen = letters.length;
|
||||||
char randomText[] = new char[size];
|
char[] randomText = new char[size];
|
||||||
Random rand = new Random(42);
|
Random rand = new Random(42);
|
||||||
|
|
||||||
for (int n = 0; n < count; n++)
|
for (int n = 0; n < count; n++)
|
||||||
|
|
|
@ -174,7 +174,7 @@ public class DecoderReaderManySmallTest
|
||||||
{
|
{
|
||||||
if (text.startsWith("seq|"))
|
if (text.startsWith("seq|"))
|
||||||
{
|
{
|
||||||
String parts[] = text.split("\\|");
|
String[] parts = text.split("\\|");
|
||||||
int from = Integer.parseInt(parts[1]);
|
int from = Integer.parseInt(parts[1]);
|
||||||
int to = Integer.parseInt(parts[2]);
|
int to = Integer.parseInt(parts[2]);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ public class MessageReceivingTest
|
||||||
{
|
{
|
||||||
session.getBasicRemote().sendBinary(BufferUtil.toBuffer("", UTF_8));
|
session.getBasicRemote().sendBinary(BufferUtil.toBuffer("", UTF_8));
|
||||||
session.getBasicRemote().sendBinary(BufferUtil.toBuffer("Echo", UTF_8));
|
session.getBasicRemote().sendBinary(BufferUtil.toBuffer("Echo", UTF_8));
|
||||||
byte bigBuf[] = new byte[1024 * 1024];
|
byte[] bigBuf = new byte[1024 * 1024];
|
||||||
Arrays.fill(bigBuf, (byte)'x');
|
Arrays.fill(bigBuf, (byte)'x');
|
||||||
// allocate fresh ByteBuffer and copy array contents, not wrap
|
// allocate fresh ByteBuffer and copy array contents, not wrap
|
||||||
// as the send will modify the wrapped array (for client masking purposes)
|
// as the send will modify the wrapped array (for client masking purposes)
|
||||||
|
@ -215,7 +215,7 @@ public class MessageReceivingTest
|
||||||
.preferredSubprotocols(Collections.singletonList("echo"))
|
.preferredSubprotocols(Collections.singletonList("echo"))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
byte raw[] = new byte[1024 * 1024];
|
byte[] raw = new byte[1024 * 1024];
|
||||||
Arrays.fill(raw, (byte)'x');
|
Arrays.fill(raw, (byte)'x');
|
||||||
String veryLongString = new String(raw, UTF_8);
|
String veryLongString = new String(raw, UTF_8);
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class MessageReceivingTest
|
||||||
@Override
|
@Override
|
||||||
public void onText(String wholeMessage, Callback callback)
|
public void onText(String wholeMessage, Callback callback)
|
||||||
{
|
{
|
||||||
String parts[] = wholeMessage.split(" ");
|
String[] parts = wholeMessage.split(" ");
|
||||||
for (int i = 0; i < parts.length; i++)
|
for (int i = 0; i < parts.length; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class AvailableDecodersTest
|
||||||
public void testCoreDecode_ByteArray() throws IllegalAccessException, InstantiationException, DecodeException
|
public void testCoreDecode_ByteArray() throws IllegalAccessException, InstantiationException, DecodeException
|
||||||
{
|
{
|
||||||
ByteBuffer val = Hex.asByteBuffer("112233445566778899");
|
ByteBuffer val = Hex.asByteBuffer("112233445566778899");
|
||||||
byte expected[] = Hex.asByteArray("112233445566778899");
|
byte[] expected = Hex.asByteArray("112233445566778899");
|
||||||
assertBinaryDecoder(byte[].class, val, expected);
|
assertBinaryDecoder(byte[].class, val, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ public class AvailableEncodersTest
|
||||||
@Test
|
@Test
|
||||||
public void testCoreEncoder_ByteArray() throws IllegalAccessException, InstantiationException, EncodeException
|
public void testCoreEncoder_ByteArray() throws IllegalAccessException, InstantiationException, EncodeException
|
||||||
{
|
{
|
||||||
byte buf[] = Hex.asByteArray("998877665544332211");
|
byte[] buf = Hex.asByteArray("998877665544332211");
|
||||||
assertBinaryEncoder(byte[].class, buf, "998877665544332211");
|
assertBinaryEncoder(byte[].class, buf, "998877665544332211");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class LargeAnnotatedTest
|
||||||
{
|
{
|
||||||
|
|
||||||
// The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies
|
// The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies
|
||||||
byte txt[] = new byte[100 * 1024];
|
byte[] txt = new byte[100 * 1024];
|
||||||
Arrays.fill(txt, (byte)'o');
|
Arrays.fill(txt, (byte)'o');
|
||||||
String msg = new String(txt, StandardCharsets.UTF_8);
|
String msg = new String(txt, StandardCharsets.UTF_8);
|
||||||
coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload(msg), Callback.NOOP, false);
|
coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload(msg), Callback.NOOP, false);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class LargeContainerTest
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies
|
// The message size should be bigger than default, but smaller than the limit that LargeEchoSocket specifies
|
||||||
byte txt[] = new byte[100 * 1024];
|
byte[] txt = new byte[100 * 1024];
|
||||||
Arrays.fill(txt, (byte)'o');
|
Arrays.fill(txt, (byte)'o');
|
||||||
String msg = new String(txt, StandardCharsets.UTF_8);
|
String msg = new String(txt, StandardCharsets.UTF_8);
|
||||||
coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload(msg), Callback.NOOP, false);
|
coreSession.sendFrame(new Frame(OpCode.TEXT).setPayload(msg), Callback.NOOP, false);
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PingPongTest
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("PongSocket.onPong(): PongMessage.appData={}", BufferUtil.toDetailString(pong.getApplicationData()));
|
LOG.debug("PongSocket.onPong(): PongMessage.appData={}", BufferUtil.toDetailString(pong.getApplicationData()));
|
||||||
byte buf[] = BufferUtil.toArray(pong.getApplicationData());
|
byte[] buf = BufferUtil.toArray(pong.getApplicationData());
|
||||||
String message = new String(buf, StandardCharsets.UTF_8);
|
String message = new String(buf, StandardCharsets.UTF_8);
|
||||||
this.session.getAsyncRemote().sendText("PongSocket.onPong(PongMessage)[" + path + "]:" + message);
|
this.session.getAsyncRemote().sendText("PongSocket.onPong(PongMessage)[" + path + "]:" + message);
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class PingPongTest
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(PongMessage pong)
|
public void onMessage(PongMessage pong)
|
||||||
{
|
{
|
||||||
byte buf[] = BufferUtil.toArray(pong.getApplicationData());
|
byte[] buf = BufferUtil.toArray(pong.getApplicationData());
|
||||||
String message = new String(buf, StandardCharsets.UTF_8);
|
String message = new String(buf, StandardCharsets.UTF_8);
|
||||||
this.session.getAsyncRemote().sendText("PongMessageEndpoint.onMessage(PongMessage):[" + path + "]:" + message);
|
this.session.getAsyncRemote().sendText("PongMessageEndpoint.onMessage(PongMessage):[" + path + "]:" + message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ public class PongSocket
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("PongSocket.onPong(): PongMessage.appData={}", BufferUtil.toDetailString(pong.getApplicationData()));
|
LOG.debug("PongSocket.onPong(): PongMessage.appData={}", BufferUtil.toDetailString(pong.getApplicationData()));
|
||||||
byte buf[] = BufferUtil.toArray(pong.getApplicationData());
|
byte[] buf = BufferUtil.toArray(pong.getApplicationData());
|
||||||
String message = new String(buf, StandardCharsets.UTF_8);
|
String message = new String(buf, StandardCharsets.UTF_8);
|
||||||
this.session.getAsyncRemote().sendText("PongSocket.onPong(PongMessage)[" + path + "]:" + message);
|
this.session.getAsyncRemote().sendText("PongSocket.onPong(PongMessage)[" + path + "]:" + message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class PrimitivesBinaryEchoTest
|
||||||
@OnMessage
|
@OnMessage
|
||||||
public byte[] onMessage(byte[] buf) throws IOException
|
public byte[] onMessage(byte[] buf) throws IOException
|
||||||
{
|
{
|
||||||
byte ret[] = new byte[buf.length + 1];
|
byte[] ret = new byte[buf.length + 1];
|
||||||
ret[0] = (byte)0xFE; // proof that this endpoint got it
|
ret[0] = (byte)0xFE; // proof that this endpoint got it
|
||||||
System.arraycopy(buf, 0, ret, 1, buf.length);
|
System.arraycopy(buf, 0, ret, 1, buf.length);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class SessionTrackingTest
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String parts[] = msg.split("\\|");
|
String[] parts = msg.split("\\|");
|
||||||
|
|
||||||
if ("openSessions".equals(parts[0]))
|
if ("openSessions".equals(parts[0]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class PongMessageEndpoint extends Endpoint implements MessageHandler.Whol
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(PongMessage pong)
|
public void onMessage(PongMessage pong)
|
||||||
{
|
{
|
||||||
byte buf[] = BufferUtil.toArray(pong.getApplicationData());
|
byte[] buf = BufferUtil.toArray(pong.getApplicationData());
|
||||||
String message = new String(buf, StandardCharsets.UTF_8);
|
String message = new String(buf, StandardCharsets.UTF_8);
|
||||||
this.session.getAsyncRemote().sendText("PongMessageEndpoint.onMessage(PongMessage):[" + path + "]:" + message);
|
this.session.getAsyncRemote().sendText("PongMessageEndpoint.onMessage(PongMessage):[" + path + "]:" + message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class ClientDemo
|
||||||
op = OpCode.BINARY;
|
op = OpCode.BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
byte data[] = null;
|
byte[] data = null;
|
||||||
|
|
||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class MessageInputStreamTest
|
||||||
stream.accept(frame, Callback.NOOP);
|
stream.accept(frame, Callback.NOOP);
|
||||||
|
|
||||||
// Read entire message it from the stream.
|
// Read entire message it from the stream.
|
||||||
byte data[] = IO.readBytes(stream);
|
byte[] data = IO.readBytes(stream);
|
||||||
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
// Test it
|
// Test it
|
||||||
|
@ -106,7 +106,7 @@ public class MessageInputStreamTest
|
||||||
startLatch.await();
|
startLatch.await();
|
||||||
|
|
||||||
// Read it from the stream.
|
// Read it from the stream.
|
||||||
byte data[] = IO.readBytes(stream);
|
byte[] data = IO.readBytes(stream);
|
||||||
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
// Test it
|
// Test it
|
||||||
|
@ -204,7 +204,7 @@ public class MessageInputStreamTest
|
||||||
stream.accept(msg3, Callback.NOOP);
|
stream.accept(msg3, Callback.NOOP);
|
||||||
|
|
||||||
// Read entire message it from the stream.
|
// Read entire message it from the stream.
|
||||||
byte data[] = IO.readBytes(stream);
|
byte[] data = IO.readBytes(stream);
|
||||||
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
// Test it
|
// Test it
|
||||||
|
@ -232,7 +232,7 @@ public class MessageInputStreamTest
|
||||||
stream.accept(msg3, Callback.NOOP);
|
stream.accept(msg3, Callback.NOOP);
|
||||||
|
|
||||||
// Read entire message it from the stream.
|
// Read entire message it from the stream.
|
||||||
byte data[] = IO.readBytes(stream);
|
byte[] data = IO.readBytes(stream);
|
||||||
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
String message = new String(data, 0, data.length, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
// Test it
|
// Test it
|
||||||
|
|
|
@ -89,7 +89,7 @@ public class MessageOutputStreamTest
|
||||||
public void testWriteLarge_RequiringMultipleBuffers() throws Exception
|
public void testWriteLarge_RequiringMultipleBuffers() throws Exception
|
||||||
{
|
{
|
||||||
int bufsize = (int)(OUTPUT_BUFFER_SIZE * 2.5);
|
int bufsize = (int)(OUTPUT_BUFFER_SIZE * 2.5);
|
||||||
byte buf[] = new byte[bufsize];
|
byte[] buf = new byte[bufsize];
|
||||||
LOG.debug("Buffer sizes: max:{}, test:{}", OUTPUT_BUFFER_SIZE, bufsize);
|
LOG.debug("Buffer sizes: max:{}, test:{}", OUTPUT_BUFFER_SIZE, bufsize);
|
||||||
Arrays.fill(buf, (byte)'x');
|
Arrays.fill(buf, (byte)'x');
|
||||||
buf[bufsize - 1] = (byte)'o'; // mark last entry for debugging
|
buf[bufsize - 1] = (byte)'o'; // mark last entry for debugging
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class MessageWriterTest
|
||||||
public void testWriteLarge_RequiringMultipleBuffers() throws Exception
|
public void testWriteLarge_RequiringMultipleBuffers() throws Exception
|
||||||
{
|
{
|
||||||
int size = (int)(OUTPUT_BUFFER_SIZE * 2.5);
|
int size = (int)(OUTPUT_BUFFER_SIZE * 2.5);
|
||||||
char buf[] = new char[size];
|
char[] buf = new char[size];
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Buffer size: {}", size);
|
LOG.debug("Buffer size: {}", size);
|
||||||
Arrays.fill(buf, 'x');
|
Arrays.fill(buf, 'x');
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method2 = ReflectUtils.findMethod(KeyValue.class, "onEntry", int.class, String.class);
|
Method method2 = ReflectUtils.findMethod(KeyValue.class, "onEntry", int.class, String.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
};
|
};
|
||||||
|
@ -182,7 +182,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
};
|
};
|
||||||
|
@ -199,7 +199,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class),
|
new InvokerUtils.Arg(int.class),
|
||||||
new InvokerUtils.Arg(Boolean.class)
|
new InvokerUtils.Arg(Boolean.class)
|
||||||
|
@ -217,7 +217,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(Long.class),
|
new InvokerUtils.Arg(Long.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
|
@ -235,7 +235,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(Simple.class),
|
new InvokerUtils.Arg(Simple.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(int.class)
|
new InvokerUtils.Arg(int.class)
|
||||||
|
@ -253,7 +253,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
Method method1 = ReflectUtils.findMethod(KeyValue.class, "onEntry", String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(Simple.class),
|
new InvokerUtils.Arg(Simple.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(Boolean.class),
|
new InvokerUtils.Arg(Boolean.class),
|
||||||
|
@ -273,7 +273,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class, "fruit"),
|
new InvokerUtils.Arg(String.class, "fruit"),
|
||||||
new InvokerUtils.Arg(String.class, "color"),
|
new InvokerUtils.Arg(String.class, "color"),
|
||||||
new InvokerUtils.Arg(int.class, "cost")
|
new InvokerUtils.Arg(int.class, "cost")
|
||||||
|
@ -291,7 +291,7 @@ public class InvokerUtilsTest
|
||||||
{
|
{
|
||||||
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
Method method = ReflectUtils.findMethod(NamedParams.class, "onMessage", String.class, String.class, int.class);
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(int.class, "cost"),
|
new InvokerUtils.Arg(int.class, "cost"),
|
||||||
new InvokerUtils.Arg(String.class, "fruit"),
|
new InvokerUtils.Arg(String.class, "fruit"),
|
||||||
new InvokerUtils.Arg(String.class, "color")
|
new InvokerUtils.Arg(String.class, "color")
|
||||||
|
@ -310,7 +310,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{};
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{};
|
||||||
|
|
||||||
MethodHandle methodHandle = InvokerUtils.mutatedInvoker(SampleSignatures.class, method, callingArgs);
|
MethodHandle methodHandle = InvokerUtils.mutatedInvoker(SampleSignatures.class, method, callingArgs);
|
||||||
String result = (String)methodHandle.invoke(samples);
|
String result = (String)methodHandle.invoke(samples);
|
||||||
|
@ -323,7 +323,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigEmpty");
|
Method method = findMethodByName(samples, "sigEmpty");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -384,7 +384,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStr");
|
Method method = findMethodByName(samples, "sigStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -400,7 +400,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStrFile");
|
Method method = findMethodByName(samples, "sigStrFile");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -416,7 +416,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigStrFile");
|
Method method = findMethodByName(samples, "sigStrFile");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -432,7 +432,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStr");
|
Method method = findMethodByName(samples, "sigFileStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(File.class)
|
new InvokerUtils.Arg(File.class)
|
||||||
};
|
};
|
||||||
|
@ -448,7 +448,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStr");
|
Method method = findMethodByName(samples, "sigFileStr");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
};
|
};
|
||||||
|
@ -464,7 +464,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(boolean.class, "fin")
|
new InvokerUtils.Arg(boolean.class, "fin")
|
||||||
|
@ -481,7 +481,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class),
|
new InvokerUtils.Arg(String.class),
|
||||||
new InvokerUtils.Arg(boolean.class)
|
new InvokerUtils.Arg(boolean.class)
|
||||||
|
@ -498,7 +498,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class, "fin"),
|
new InvokerUtils.Arg(boolean.class, "fin"),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
@ -515,7 +515,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class),
|
new InvokerUtils.Arg(boolean.class),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
@ -532,7 +532,7 @@ public class InvokerUtilsTest
|
||||||
SampleSignatures samples = new SampleSignatures();
|
SampleSignatures samples = new SampleSignatures();
|
||||||
Method method = findMethodByName(samples, "sigFileStrFin");
|
Method method = findMethodByName(samples, "sigFileStrFin");
|
||||||
|
|
||||||
InvokerUtils.Arg callingArgs[] = new InvokerUtils.Arg[]{
|
InvokerUtils.Arg[] callingArgs = new InvokerUtils.Arg[]{
|
||||||
new InvokerUtils.Arg(boolean.class, "fin"),
|
new InvokerUtils.Arg(boolean.class, "fin"),
|
||||||
new InvokerUtils.Arg(File.class),
|
new InvokerUtils.Arg(File.class),
|
||||||
new InvokerUtils.Arg(String.class)
|
new InvokerUtils.Arg(String.class)
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class NameParamIdentifier implements InvokerUtils.ParamIdentifier
|
||||||
@Override
|
@Override
|
||||||
public InvokerUtils.Arg getParamArg(Method method, Class<?> paramType, int idx)
|
public InvokerUtils.Arg getParamArg(Method method, Class<?> paramType, int idx)
|
||||||
{
|
{
|
||||||
Annotation annos[] = method.getParameterAnnotations()[idx];
|
Annotation[] annos = method.getParameterAnnotations()[idx];
|
||||||
if (annos != null || (annos.length > 0))
|
if (annos != null || (annos.length > 0))
|
||||||
{
|
{
|
||||||
for (Annotation anno : annos)
|
for (Annotation anno : annos)
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class Utf8CharBufferTest
|
||||||
ByteBuffer buf = ByteBuffer.allocate(128);
|
ByteBuffer buf = ByteBuffer.allocate(128);
|
||||||
Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf);
|
Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf);
|
||||||
|
|
||||||
byte hellobytes[] = asUTF("Hello ");
|
byte[] hellobytes = asUTF("Hello ");
|
||||||
byte worldbytes[] = asUTF("World!");
|
byte[] worldbytes = asUTF("World!");
|
||||||
|
|
||||||
utf.append(hellobytes, 0, hellobytes.length);
|
utf.append(hellobytes, 0, hellobytes.length);
|
||||||
ByteBuffer hellobuf = utf.getByteBuffer();
|
ByteBuffer hellobuf = utf.getByteBuffer();
|
||||||
|
@ -67,7 +67,7 @@ public class Utf8CharBufferTest
|
||||||
int expectedSize = bufsize / 2;
|
int expectedSize = bufsize / 2;
|
||||||
assertThat("Remaining (initial)", utf.remaining(), is(expectedSize));
|
assertThat("Remaining (initial)", utf.remaining(), is(expectedSize));
|
||||||
|
|
||||||
byte hellobytes[] = asUTF("Hello World");
|
byte[] hellobytes = asUTF("Hello World");
|
||||||
|
|
||||||
utf.append(hellobytes, 0, hellobytes.length);
|
utf.append(hellobytes, 0, hellobytes.length);
|
||||||
ByteBuffer hellobuf = utf.getByteBuffer();
|
ByteBuffer hellobuf = utf.getByteBuffer();
|
||||||
|
@ -79,7 +79,7 @@ public class Utf8CharBufferTest
|
||||||
|
|
||||||
assertThat("Remaining (after clear)", utf.remaining(), is(expectedSize));
|
assertThat("Remaining (after clear)", utf.remaining(), is(expectedSize));
|
||||||
|
|
||||||
byte whatnowbytes[] = asUTF("What Now?");
|
byte[] whatnowbytes = asUTF("What Now?");
|
||||||
utf.append(whatnowbytes, 0, whatnowbytes.length);
|
utf.append(whatnowbytes, 0, whatnowbytes.length);
|
||||||
ByteBuffer whatnowbuf = utf.getByteBuffer();
|
ByteBuffer whatnowbuf = utf.getByteBuffer();
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class Utf8CharBufferTest
|
||||||
ByteBuffer buf = ByteBuffer.allocate(64);
|
ByteBuffer buf = ByteBuffer.allocate(64);
|
||||||
Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf);
|
Utf8CharBuffer utf = Utf8CharBuffer.wrap(buf);
|
||||||
|
|
||||||
byte bb[] = asUTF("Hello A\u00ea\u00f1\u00fcC");
|
byte[] bb = asUTF("Hello A\u00ea\u00f1\u00fcC");
|
||||||
utf.append(bb, 0, bb.length);
|
utf.append(bb, 0, bb.length);
|
||||||
|
|
||||||
ByteBuffer actual = utf.getByteBuffer();
|
ByteBuffer actual = utf.getByteBuffer();
|
||||||
|
@ -111,7 +111,7 @@ public class Utf8CharBufferTest
|
||||||
int expectedSize = bufsize / 2;
|
int expectedSize = bufsize / 2;
|
||||||
assertThat("Remaining (initial)", utf.remaining(), is(expectedSize));
|
assertThat("Remaining (initial)", utf.remaining(), is(expectedSize));
|
||||||
|
|
||||||
byte bb[] = asUTF("Hello World");
|
byte[] bb = asUTF("Hello World");
|
||||||
utf.append(bb, 0, bb.length);
|
utf.append(bb, 0, bb.length);
|
||||||
|
|
||||||
expectedSize -= bb.length;
|
expectedSize -= bb.length;
|
||||||
|
|
|
@ -62,9 +62,9 @@ public class BrowserSocket
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
||||||
int lettersLen = letters.length;
|
int lettersLen = letters.length;
|
||||||
char randomText[] = new char[size];
|
char[] randomText = new char[size];
|
||||||
Random rand = new Random(42);
|
Random rand = new Random(42);
|
||||||
String msg;
|
String msg;
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public class BrowserSocket
|
||||||
}
|
}
|
||||||
case "many":
|
case "many":
|
||||||
{
|
{
|
||||||
String parts[] = val.split(",");
|
String[] parts = val.split(",");
|
||||||
int size = Integer.parseInt(parts[0]);
|
int size = Integer.parseInt(parts[0]);
|
||||||
int count = Integer.parseInt(parts[1]);
|
int count = Integer.parseInt(parts[1]);
|
||||||
|
|
||||||
|
@ -213,12 +213,12 @@ public class BrowserSocket
|
||||||
}
|
}
|
||||||
case "manythreads":
|
case "manythreads":
|
||||||
{
|
{
|
||||||
String parts[] = val.split(",");
|
String[] parts = val.split(",");
|
||||||
int threadCount = Integer.parseInt(parts[0]);
|
int threadCount = Integer.parseInt(parts[0]);
|
||||||
int size = Integer.parseInt(parts[1]);
|
int size = Integer.parseInt(parts[1]);
|
||||||
int count = Integer.parseInt(parts[2]);
|
int count = Integer.parseInt(parts[2]);
|
||||||
|
|
||||||
Thread threads[] = new Thread[threadCount];
|
Thread[] threads = new Thread[threadCount];
|
||||||
|
|
||||||
// Setup threads
|
// Setup threads
|
||||||
for (int n = 0; n < threadCount; n++)
|
for (int n = 0; n < threadCount; n++)
|
||||||
|
@ -263,9 +263,9 @@ public class BrowserSocket
|
||||||
|
|
||||||
private void writeManyAsync(int size, int count)
|
private void writeManyAsync(int size, int count)
|
||||||
{
|
{
|
||||||
char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
char[] letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-|{}[]():".toCharArray();
|
||||||
int lettersLen = letters.length;
|
int lettersLen = letters.length;
|
||||||
char randomText[] = new char[size];
|
char[] randomText = new char[size];
|
||||||
Random rand = new Random(42);
|
Random rand = new Random(42);
|
||||||
|
|
||||||
for (int n = 0; n < count; n++)
|
for (int n = 0; n < count; n++)
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class AcceptHashTest
|
||||||
{
|
{
|
||||||
private static String hexAsKey(String hex)
|
private static String hexAsKey(String hex)
|
||||||
{
|
{
|
||||||
byte key[] = TypeUtil.fromHexString(hex);
|
byte[] key = TypeUtil.fromHexString(hex);
|
||||||
assertThat("Key size of hex:[" + hex + "]", key.length, is(16));
|
assertThat("Key size of hex:[" + hex + "]", key.length, is(16));
|
||||||
return Base64.getEncoder().encodeToString(key);
|
return Base64.getEncoder().encodeToString(key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class CloseStatusTest
|
||||||
private ByteBuffer asByteBuffer(int statusCode, String reason)
|
private ByteBuffer asByteBuffer(int statusCode, String reason)
|
||||||
{
|
{
|
||||||
int len = 2; // status code length
|
int len = 2; // status code length
|
||||||
byte utf[] = null;
|
byte[] utf = null;
|
||||||
if (StringUtil.isNotBlank(reason))
|
if (StringUtil.isNotBlank(reason))
|
||||||
{
|
{
|
||||||
utf = StringUtil.getUtf8Bytes(reason);
|
utf = StringUtil.getUtf8Bytes(reason);
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class GeneratorParserRoundtripTest
|
||||||
Frame frame = new Frame(OpCode.TEXT).setPayload(message);
|
Frame frame = new Frame(OpCode.TEXT).setPayload(message);
|
||||||
|
|
||||||
// Add masking
|
// Add masking
|
||||||
byte mask[] = new byte[4];
|
byte[] mask = new byte[4];
|
||||||
Arrays.fill(mask, (byte)0xFF);
|
Arrays.fill(mask, (byte)0xFF);
|
||||||
frame.setMask(mask);
|
frame.setMask(mask);
|
||||||
|
|
||||||
|
|
|
@ -444,7 +444,7 @@ public class GeneratorTest
|
||||||
ByteBuffer actual = generate(close.toFrame());
|
ByteBuffer actual = generate(close.toFrame());
|
||||||
ByteBuffer expected = ByteBuffer.allocate(132);
|
ByteBuffer expected = ByteBuffer.allocate(132);
|
||||||
|
|
||||||
byte messageBytes[] = message.toString().getBytes(StandardCharsets.UTF_8);
|
byte[] messageBytes = message.toString().getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
expected.put(new byte[]
|
expected.put(new byte[]
|
||||||
{(byte)0x88});
|
{(byte)0x88});
|
||||||
|
@ -507,7 +507,7 @@ public class GeneratorTest
|
||||||
frames[pingCount] = CloseStatus.toFrame(CloseStatus.NORMAL);
|
frames[pingCount] = CloseStatus.toFrame(CloseStatus.NORMAL);
|
||||||
|
|
||||||
// Mask All Frames
|
// Mask All Frames
|
||||||
byte maskingKey[] = Hex.asByteArray("11223344");
|
byte[] maskingKey = Hex.asByteArray("11223344");
|
||||||
for (Frame f : frames)
|
for (Frame f : frames)
|
||||||
{
|
{
|
||||||
f.setMask(maskingKey);
|
f.setMask(maskingKey);
|
||||||
|
@ -520,7 +520,7 @@ public class GeneratorTest
|
||||||
expected.append("8986").append("11223344");
|
expected.append("8986").append("11223344");
|
||||||
expected.append(asMaskedHex("ping-1", maskingKey)); // ping 1
|
expected.append(asMaskedHex("ping-1", maskingKey)); // ping 1
|
||||||
expected.append("8882").append("11223344");
|
expected.append("8882").append("11223344");
|
||||||
byte closure[] = Hex.asByteArray("03E8");
|
byte[] closure = Hex.asByteArray("03E8");
|
||||||
mask(closure, maskingKey);
|
mask(closure, maskingKey);
|
||||||
expected.append(Hex.asHex(closure)); // normal closure
|
expected.append(Hex.asHex(closure)); // normal closure
|
||||||
|
|
||||||
|
@ -756,7 +756,7 @@ public class GeneratorTest
|
||||||
int dataSize = 256;
|
int dataSize = 256;
|
||||||
|
|
||||||
Frame binary = new Frame(OpCode.BINARY);
|
Frame binary = new Frame(OpCode.BINARY);
|
||||||
byte payload[] = new byte[dataSize];
|
byte[] payload = new byte[dataSize];
|
||||||
Arrays.fill(payload, (byte)0x44);
|
Arrays.fill(payload, (byte)0x44);
|
||||||
binary.setPayload(ByteBuffer.wrap(payload));
|
binary.setPayload(ByteBuffer.wrap(payload));
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ public class GeneratorTest
|
||||||
int dataSize = 1024 * 64;
|
int dataSize = 1024 * 64;
|
||||||
|
|
||||||
Frame binary = new Frame(OpCode.BINARY);
|
Frame binary = new Frame(OpCode.BINARY);
|
||||||
byte payload[] = new byte[dataSize];
|
byte[] payload = new byte[dataSize];
|
||||||
Arrays.fill(payload, (byte)0x44);
|
Arrays.fill(payload, (byte)0x44);
|
||||||
binary.setPayload(ByteBuffer.wrap(payload));
|
binary.setPayload(ByteBuffer.wrap(payload));
|
||||||
|
|
||||||
|
@ -866,7 +866,7 @@ public class GeneratorTest
|
||||||
public void testGenerate_Text_125BytePaylod()
|
public void testGenerate_Text_125BytePaylod()
|
||||||
{
|
{
|
||||||
int length = 125;
|
int length = 125;
|
||||||
byte buf[] = new byte[length];
|
byte[] buf = new byte[length];
|
||||||
Arrays.fill(buf, (byte)'*');
|
Arrays.fill(buf, (byte)'*');
|
||||||
String text = new String(buf, StandardCharsets.UTF_8);
|
String text = new String(buf, StandardCharsets.UTF_8);
|
||||||
|
|
||||||
|
@ -1119,7 +1119,7 @@ public class GeneratorTest
|
||||||
public void testGenerate_Text_Hello()
|
public void testGenerate_Text_Hello()
|
||||||
{
|
{
|
||||||
Frame frame = new Frame(OpCode.TEXT).setPayload("Hello");
|
Frame frame = new Frame(OpCode.TEXT).setPayload("Hello");
|
||||||
byte utf[] = StringUtil.getUtf8Bytes("Hello");
|
byte[] utf = StringUtil.getUtf8Bytes("Hello");
|
||||||
assertGeneratedBytes("8105" + Hex.asHex(utf), frame);
|
assertGeneratedBytes("8105" + Hex.asHex(utf), frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1127,7 +1127,7 @@ public class GeneratorTest
|
||||||
public void testGenerate_Text_Masked()
|
public void testGenerate_Text_Masked()
|
||||||
{
|
{
|
||||||
Frame frame = new Frame(OpCode.TEXT).setPayload("Hello");
|
Frame frame = new Frame(OpCode.TEXT).setPayload("Hello");
|
||||||
byte maskingKey[] = Hex.asByteArray("11223344");
|
byte[] maskingKey = Hex.asByteArray("11223344");
|
||||||
frame.setMask(maskingKey);
|
frame.setMask(maskingKey);
|
||||||
|
|
||||||
// what is expected
|
// what is expected
|
||||||
|
@ -1153,7 +1153,7 @@ public class GeneratorTest
|
||||||
// payload does not start at position 0.
|
// payload does not start at position 0.
|
||||||
LOG.debug("Payload = {}", BufferUtil.toDetailString(payload));
|
LOG.debug("Payload = {}", BufferUtil.toDetailString(payload));
|
||||||
Frame frame = new Frame(OpCode.TEXT).setPayload(payload);
|
Frame frame = new Frame(OpCode.TEXT).setPayload(payload);
|
||||||
byte maskingKey[] = Hex.asByteArray("11223344");
|
byte[] maskingKey = Hex.asByteArray("11223344");
|
||||||
frame.setMask(maskingKey);
|
frame.setMask(maskingKey);
|
||||||
|
|
||||||
// what is expected
|
// what is expected
|
||||||
|
@ -1172,7 +1172,7 @@ public class GeneratorTest
|
||||||
public void testGenerate_Windowed()
|
public void testGenerate_Windowed()
|
||||||
{
|
{
|
||||||
// A decent sized frame, no masking
|
// A decent sized frame, no masking
|
||||||
byte payload[] = new byte[10240];
|
byte[] payload = new byte[10240];
|
||||||
Arrays.fill(payload, (byte)0x44);
|
Arrays.fill(payload, (byte)0x44);
|
||||||
|
|
||||||
Frame frame = new Frame(OpCode.BINARY).setPayload(payload);
|
Frame frame = new Frame(OpCode.BINARY).setPayload(payload);
|
||||||
|
@ -1200,10 +1200,10 @@ public class GeneratorTest
|
||||||
public void testGenerate_WithMasking() throws Exception
|
public void testGenerate_WithMasking() throws Exception
|
||||||
{
|
{
|
||||||
// A decent sized frame, with masking
|
// A decent sized frame, with masking
|
||||||
byte payload[] = new byte[10240];
|
byte[] payload = new byte[10240];
|
||||||
Arrays.fill(payload, (byte)0x55);
|
Arrays.fill(payload, (byte)0x55);
|
||||||
|
|
||||||
byte mask[] = new byte[]
|
byte[] mask = new byte[]
|
||||||
{0x2A, (byte)0xF0, 0x0F, 0x00};
|
{0x2A, (byte)0xF0, 0x0F, 0x00};
|
||||||
|
|
||||||
Frame frame = new Frame(OpCode.BINARY).setPayload(payload);
|
Frame frame = new Frame(OpCode.BINARY).setPayload(payload);
|
||||||
|
@ -1308,7 +1308,7 @@ public class GeneratorTest
|
||||||
|
|
||||||
private String asMaskedHex(String str, byte[] maskingKey)
|
private String asMaskedHex(String str, byte[] maskingKey)
|
||||||
{
|
{
|
||||||
byte utf[] = StringUtil.getUtf8Bytes(str);
|
byte[] utf = StringUtil.getUtf8Bytes(str);
|
||||||
mask(utf, maskingKey);
|
mask(utf, maskingKey);
|
||||||
return Hex.asHex(utf);
|
return Hex.asHex(utf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ParsePayloadLengthTest
|
||||||
// Create text frame
|
// Create text frame
|
||||||
RawFrameBuilder.putOpFin(raw, OpCode.TEXT, true);
|
RawFrameBuilder.putOpFin(raw, OpCode.TEXT, true);
|
||||||
RawFrameBuilder.putLength(raw, size, false); // len of closeCode
|
RawFrameBuilder.putLength(raw, size, false); // len of closeCode
|
||||||
byte payload[] = new byte[size];
|
byte[] payload = new byte[size];
|
||||||
Arrays.fill(payload, (byte)'x');
|
Arrays.fill(payload, (byte)'x');
|
||||||
raw.put(payload);
|
raw.put(payload);
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,7 @@ public class ParserReservedBitTest
|
||||||
@Test
|
@Test
|
||||||
public void testCase3_5()
|
public void testCase3_5()
|
||||||
{
|
{
|
||||||
byte payload[] = new byte[8];
|
byte[] payload = new byte[8];
|
||||||
Arrays.fill(payload, (byte)0xFF);
|
Arrays.fill(payload, (byte)0xFF);
|
||||||
|
|
||||||
List<Frame> send = new ArrayList<>();
|
List<Frame> send = new ArrayList<>();
|
||||||
|
@ -167,7 +167,7 @@ public class ParserReservedBitTest
|
||||||
@Test
|
@Test
|
||||||
public void testCase3_6()
|
public void testCase3_6()
|
||||||
{
|
{
|
||||||
byte payload[] = new byte[8];
|
byte[] payload = new byte[8];
|
||||||
Arrays.fill(payload, (byte)0xFF);
|
Arrays.fill(payload, (byte)0xFF);
|
||||||
|
|
||||||
List<Frame> send = new ArrayList<>();
|
List<Frame> send = new ArrayList<>();
|
||||||
|
|
|
@ -470,13 +470,13 @@ public class ParserTest
|
||||||
public void testParse_Continuation_ManySmall()
|
public void testParse_Continuation_ManySmall()
|
||||||
{
|
{
|
||||||
String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!";
|
String utf8 = "Hello-\uC2B5@\uC39F\uC3A4\uC3BC\uC3A0\uC3A1-UTF-8!!";
|
||||||
byte msg[] = StringUtil.getUtf8Bytes(utf8);
|
byte[] msg = StringUtil.getUtf8Bytes(utf8);
|
||||||
|
|
||||||
List<Frame> send = new ArrayList<>();
|
List<Frame> send = new ArrayList<>();
|
||||||
int textCount = 0;
|
int textCount = 0;
|
||||||
int continuationCount = 0;
|
int continuationCount = 0;
|
||||||
int len = msg.length;
|
int len = msg.length;
|
||||||
byte mini[];
|
byte[] mini;
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
Frame frame;
|
Frame frame;
|
||||||
|
@ -1287,7 +1287,7 @@ public class ParserTest
|
||||||
// Artificially small buffer/payload
|
// Artificially small buffer/payload
|
||||||
final int maxAllowedFrameSize = 1024;
|
final int maxAllowedFrameSize = 1024;
|
||||||
|
|
||||||
byte utf[] = new byte[2048];
|
byte[] utf = new byte[2048];
|
||||||
Arrays.fill(utf, (byte)'a');
|
Arrays.fill(utf, (byte)'a');
|
||||||
|
|
||||||
assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF)));
|
assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF)));
|
||||||
|
@ -1317,7 +1317,7 @@ public class ParserTest
|
||||||
sb.append(". The end.");
|
sb.append(". The end.");
|
||||||
|
|
||||||
String expectedText = sb.toString();
|
String expectedText = sb.toString();
|
||||||
byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
|
byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
assertThat("Must be a long length payload", utf.length, greaterThan(0xFFFF));
|
assertThat("Must be a long length payload", utf.length, greaterThan(0xFFFF));
|
||||||
|
|
||||||
|
@ -1340,7 +1340,7 @@ public class ParserTest
|
||||||
public void testParse_Text_ManySmallBuffers_NoAutoFragmentation() throws InterruptedException
|
public void testParse_Text_ManySmallBuffers_NoAutoFragmentation() throws InterruptedException
|
||||||
{
|
{
|
||||||
// Create frames
|
// Create frames
|
||||||
byte payload[] = new byte[65536];
|
byte[] payload = new byte[65536];
|
||||||
Arrays.fill(payload, (byte)'*');
|
Arrays.fill(payload, (byte)'*');
|
||||||
|
|
||||||
List<Frame> frames = new ArrayList<>();
|
List<Frame> frames = new ArrayList<>();
|
||||||
|
@ -1389,7 +1389,7 @@ public class ParserTest
|
||||||
sb.append(". The end.");
|
sb.append(". The end.");
|
||||||
|
|
||||||
String expectedText = sb.toString();
|
String expectedText = sb.toString();
|
||||||
byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
|
byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF)));
|
assertThat("Must be a medium length payload", utf.length, allOf(greaterThan(0x7E), lessThan(0xFFFF)));
|
||||||
|
|
||||||
|
@ -1412,7 +1412,7 @@ public class ParserTest
|
||||||
public void testParse_Text_ShortMasked() throws Exception
|
public void testParse_Text_ShortMasked() throws Exception
|
||||||
{
|
{
|
||||||
String expectedText = "Hello World";
|
String expectedText = "Hello World";
|
||||||
byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
|
byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.allocate(24);
|
ByteBuffer buf = ByteBuffer.allocate(24);
|
||||||
buf.put((byte)0x81);
|
buf.put((byte)0x81);
|
||||||
|
@ -1468,7 +1468,7 @@ public class ParserTest
|
||||||
{
|
{
|
||||||
String expectedText = "Hell\uFF4f W\uFF4Frld";
|
String expectedText = "Hell\uFF4f W\uFF4Frld";
|
||||||
|
|
||||||
byte utf[] = expectedText.getBytes(StandardCharsets.UTF_8);
|
byte[] utf = expectedText.getBytes(StandardCharsets.UTF_8);
|
||||||
|
|
||||||
ByteBuffer buf = ByteBuffer.allocate(24);
|
ByteBuffer buf = ByteBuffer.allocate(24);
|
||||||
buf.put((byte)0x81);
|
buf.put((byte)0x81);
|
||||||
|
|
|
@ -217,7 +217,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
public void testCompress_TimeTimeTime()
|
public void testCompress_TimeTimeTime()
|
||||||
{
|
{
|
||||||
// What pywebsocket produces for "time:", "time:", "time:"
|
// What pywebsocket produces for "time:", "time:", "time:"
|
||||||
String expected[] = new String[]
|
String[] expected = new String[]
|
||||||
{"2AC9CC4DB50200", "2A01110000", "02130000"};
|
{"2AC9CC4DB50200", "2A01110000", "02130000"};
|
||||||
|
|
||||||
// Lets see what we produce
|
// Lets see what we produce
|
||||||
|
@ -250,7 +250,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
|
|
||||||
// Text to compress
|
// Text to compress
|
||||||
String text = "info:";
|
String text = "info:";
|
||||||
byte uncompressed[] = StringUtil.getUtf8Bytes(text);
|
byte[] uncompressed = StringUtil.getUtf8Bytes(text);
|
||||||
|
|
||||||
// Prime the compressor
|
// Prime the compressor
|
||||||
compressor.reset();
|
compressor.reset();
|
||||||
|
@ -263,7 +263,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
|
|
||||||
while (!compressor.finished())
|
while (!compressor.finished())
|
||||||
{
|
{
|
||||||
byte out[] = new byte[64];
|
byte[] out = new byte[64];
|
||||||
int len = compressor.deflate(out, 0, out.length, Deflater.SYNC_FLUSH);
|
int len = compressor.deflate(out, 0, out.length, Deflater.SYNC_FLUSH);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
compressor.end();
|
compressor.end();
|
||||||
|
|
||||||
BufferUtil.flipToFlush(outbuf, 0);
|
BufferUtil.flipToFlush(outbuf, 0);
|
||||||
byte compressed[] = BufferUtil.toArray(outbuf);
|
byte[] compressed = BufferUtil.toArray(outbuf);
|
||||||
// Clear the BFINAL bit that has been set by the compressor.end() call.
|
// Clear the BFINAL bit that has been set by the compressor.end() call.
|
||||||
// In the real implementation we never end() the compressor.
|
// In the real implementation we never end() the compressor.
|
||||||
compressed[0] &= 0xFE;
|
compressed[0] &= 0xFE;
|
||||||
|
@ -305,14 +305,14 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
public void testInflateBasics() throws Exception
|
public void testInflateBasics() throws Exception
|
||||||
{
|
{
|
||||||
// should result in "info:" text if properly inflated
|
// should result in "info:" text if properly inflated
|
||||||
byte rawbuf[] = TypeUtil.fromHexString("CaCc4bCbB70200"); // what pywebsocket produces
|
byte[] rawbuf = TypeUtil.fromHexString("CaCc4bCbB70200"); // what pywebsocket produces
|
||||||
// byte rawbuf[] = TypeUtil.fromHexString("CbCc4bCbB70200"); // what java produces
|
// byte[] rawbuf = TypeUtil.fromHexString("CbCc4bCbB70200"); // what java produces
|
||||||
|
|
||||||
Inflater inflater = new Inflater(true);
|
Inflater inflater = new Inflater(true);
|
||||||
inflater.reset();
|
inflater.reset();
|
||||||
inflater.setInput(rawbuf, 0, rawbuf.length);
|
inflater.setInput(rawbuf, 0, rawbuf.length);
|
||||||
|
|
||||||
byte outbuf[] = new byte[64];
|
byte[] outbuf = new byte[64];
|
||||||
int len = inflater.inflate(outbuf);
|
int len = inflater.inflate(outbuf);
|
||||||
inflater.end();
|
inflater.end();
|
||||||
assertThat("Inflated length", len, greaterThan(4));
|
assertThat("Inflated length", len, greaterThan(4));
|
||||||
|
@ -325,7 +325,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
public void testPyWebSocketServer_Hello()
|
public void testPyWebSocketServer_Hello()
|
||||||
{
|
{
|
||||||
// Captured from PyWebSocket - "Hello" (echo from server)
|
// Captured from PyWebSocket - "Hello" (echo from server)
|
||||||
byte rawbuf[] = TypeUtil.fromHexString("c107f248cdc9c90700");
|
byte[] rawbuf = TypeUtil.fromHexString("c107f248cdc9c90700");
|
||||||
assertIncoming(rawbuf, "Hello");
|
assertIncoming(rawbuf, "Hello");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
public void testPyWebSocketServer_Long()
|
public void testPyWebSocketServer_Long()
|
||||||
{
|
{
|
||||||
// Captured from PyWebSocket - Long Text (echo from server)
|
// Captured from PyWebSocket - Long Text (echo from server)
|
||||||
byte rawbuf[] = TypeUtil.fromHexString("c1421cca410a80300c44d1abccce9df7" + "f018298634d05631138ab7b7b8fdef1f" + "dc0282e2061d575a45f6f2686bab25e1"
|
byte[] rawbuf = TypeUtil.fromHexString("c1421cca410a80300c44d1abccce9df7" + "f018298634d05631138ab7b7b8fdef1f" + "dc0282e2061d575a45f6f2686bab25e1"
|
||||||
+ "3fb7296fa02b5885eb3b0379c394f461" + "98cafd03");
|
+ "3fb7296fa02b5885eb3b0379c394f461" + "98cafd03");
|
||||||
assertIncoming(rawbuf, "It's a big enough umbrella but it's always me that ends up getting wet.");
|
assertIncoming(rawbuf, "It's a big enough umbrella but it's always me that ends up getting wet.");
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ public class DeflateFrameExtensionTest extends AbstractExtensionTest
|
||||||
public void testPyWebSocketServer_Medium()
|
public void testPyWebSocketServer_Medium()
|
||||||
{
|
{
|
||||||
// Captured from PyWebSocket - "stackoverflow" (echo from server)
|
// Captured from PyWebSocket - "stackoverflow" (echo from server)
|
||||||
byte rawbuf[] = TypeUtil.fromHexString("c10f2a2e494ccece2f4b2d4acbc92f0700");
|
byte[] rawbuf = TypeUtil.fromHexString("c10f2a2e494ccece2f4b2d4acbc92f0700");
|
||||||
assertIncoming(rawbuf, "stackoverflow");
|
assertIncoming(rawbuf, "stackoverflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ public class ExtensionConfigTest
|
||||||
@Test
|
@Test
|
||||||
public void testParseList_Simple()
|
public void testParseList_Simple()
|
||||||
{
|
{
|
||||||
String rawHeaders[] = new String[]{
|
String[] rawHeaders = new String[]{
|
||||||
"permessage-compress; client_max_window_bits",
|
"permessage-compress; client_max_window_bits",
|
||||||
"capture; output=\"wscapture.log\"",
|
"capture; output=\"wscapture.log\"",
|
||||||
"identity"
|
"identity"
|
||||||
|
@ -147,7 +147,7 @@ public class ExtensionConfigTest
|
||||||
@Test
|
@Test
|
||||||
public void testParseList_Unsplit()
|
public void testParseList_Unsplit()
|
||||||
{
|
{
|
||||||
String rawHeaders[] = new String[]{
|
String[] rawHeaders = new String[]{
|
||||||
"permessage-compress; client_max_window_bits, identity",
|
"permessage-compress; client_max_window_bits, identity",
|
||||||
"capture; output=\"wscapture.log\""
|
"capture; output=\"wscapture.log\""
|
||||||
};
|
};
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class ExtensionTool
|
||||||
public void parseIncomingHex(String... rawhex)
|
public void parseIncomingHex(String... rawhex)
|
||||||
{
|
{
|
||||||
int parts = rawhex.length;
|
int parts = rawhex.length;
|
||||||
byte net[];
|
byte[] net;
|
||||||
|
|
||||||
for (int i = 0; i < parts; i++)
|
for (int i = 0; i < parts; i++)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ public class ExtensionTool
|
||||||
|
|
||||||
public void assertHasFrames(String... textFrames)
|
public void assertHasFrames(String... textFrames)
|
||||||
{
|
{
|
||||||
Frame frames[] = new Frame[textFrames.length];
|
Frame[] frames = new Frame[textFrames.length];
|
||||||
for (int i = 0; i < frames.length; i++)
|
for (int i = 0; i < frames.length; i++)
|
||||||
{
|
{
|
||||||
frames[i] = new Frame(OpCode.TEXT).setPayload(textFrames[i]);
|
frames[i] = new Frame(OpCode.TEXT).setPayload(textFrames[i]);
|
||||||
|
|
|
@ -115,7 +115,7 @@ public class MultiPartTest extends HttpServlet
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
int bufferSize = 8192;
|
int bufferSize = 8192;
|
||||||
byte buffer[] = new byte[bufferSize];
|
byte[] buffer = new byte[bufferSize];
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue