Skip to content

Commit c123636

Browse files
committed
Revert UTF-8 unit test that does not verify the fix
The test passes regardless of whether UTF-8 is explicitly specified, because the test environment default charset is already UTF-8.
1 parent 5f0419e commit c123636

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

mcp-test/src/test/java/io/modelcontextprotocol/server/transport/StdioServerTransportProviderTests.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -135,51 +135,6 @@ void shouldHandleIncomingMessages() throws Exception {
135135
}).verifyComplete();
136136
}
137137

138-
@Test
139-
@SuppressWarnings("unchecked")
140-
void shouldHandleUtf8EncodedMessages() throws Exception {
141-
142-
String utf8Content = "한글 漢字 café 🎉";
143-
String jsonMessage = "{\"jsonrpc\":\"2.0\",\"method\":\"test\"," + "\"params\":{\"message\":\"" + utf8Content
144-
+ "\"},\"id\":1}\n";
145-
InputStream stream = new ByteArrayInputStream(jsonMessage.getBytes(StandardCharsets.UTF_8));
146-
147-
transportProvider = new StdioServerTransportProvider(McpJsonDefaults.getMapper(), stream, System.out);
148-
// Set up a real session to capture the message
149-
AtomicReference<McpSchema.JSONRPCMessage> capturedMessage = new AtomicReference<>();
150-
CountDownLatch messageLatch = new CountDownLatch(1);
151-
152-
McpServerSession.Factory realSessionFactory = transport -> {
153-
McpServerSession session = mock(McpServerSession.class);
154-
when(session.handle(any())).thenAnswer(invocation -> {
155-
capturedMessage.set(invocation.getArgument(0));
156-
messageLatch.countDown();
157-
return Mono.empty();
158-
});
159-
when(session.closeGracefully()).thenReturn(Mono.empty());
160-
return session;
161-
};
162-
163-
// Set session factory
164-
transportProvider.setSessionFactory(realSessionFactory);
165-
166-
// Wait for the message to be processed using the latch
167-
StepVerifier.create(Mono.fromCallable(() -> messageLatch.await(100, TimeUnit.SECONDS)).flatMap(success -> {
168-
if (!success) {
169-
return Mono.error(new AssertionError("Timeout waiting for message processing"));
170-
}
171-
return Mono.just(capturedMessage.get());
172-
})).assertNext(message -> {
173-
assertThat(message).isNotNull();
174-
assertThat(message).isInstanceOf(McpSchema.JSONRPCRequest.class);
175-
McpSchema.JSONRPCRequest request = (McpSchema.JSONRPCRequest) message;
176-
assertThat(request.method()).isEqualTo("test");
177-
assertThat(request.id()).isEqualTo(1);
178-
Map<String, Object> params = (Map<String, Object>) request.params();
179-
assertThat(params).containsEntry("message", utf8Content);
180-
}).verifyComplete();
181-
}
182-
183138
@Test
184139
void shouldNotifyClients() {
185140
// Set session factory

0 commit comments

Comments
 (0)