Skip to content

Commit bb21e27

Browse files
committed
Fix more ports
1 parent 6306a21 commit bb21e27

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

tests/ModelContextProtocol.Tests/SseIntegrationTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public async Task ConnectAndReceiveMessage_InMemoryServer()
4040
Name = "In-memory Test Server",
4141
TransportType = TransportTypes.Sse,
4242
TransportOptions = [],
43-
Location = "http://localhost:5000/sse"
43+
Location = $"http://localhost:{server.Port}/sse"
4444
};
4545

4646
// Act
@@ -186,7 +186,7 @@ public async Task ConnectAndReceiveMessage_InMemoryServer_WithFullEndpointEventU
186186
Name = "In-memory Test Server",
187187
TransportType = TransportTypes.Sse,
188188
TransportOptions = [],
189-
Location = "http://localhost:5000/sse"
189+
Location = $"http://localhost:{server.Port}/sse"
190190
};
191191

192192
// Act
@@ -225,7 +225,7 @@ public async Task ConnectAndReceiveNotification_InMemoryServer()
225225
Name = "In-memory Test Server",
226226
TransportType = TransportTypes.Sse,
227227
TransportOptions = [],
228-
Location = "http://localhost:5000/sse"
228+
Location = $"http://localhost:{server.Port}/sse"
229229
};
230230

231231
// Act

tests/ModelContextProtocol.Tests/Utils/InMemoryTestSseServer.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public sealed class InMemoryTestSseServer : IAsyncDisposable
2626

2727
public InMemoryTestSseServer(int port = 5000, ILogger<InMemoryTestSseServer>? logger = null)
2828
{
29+
Port = port;
30+
2931
_listener = new HttpListener();
3032
_listener.Prefixes.Add($"http://localhost:{port}/");
3133
_cts = new CancellationTokenSource();
@@ -35,6 +37,8 @@ public InMemoryTestSseServer(int port = 5000, ILogger<InMemoryTestSseServer>? lo
3537
_messagePath = "/message";
3638
}
3739

40+
public int Port { get; }
41+
3842
/// <summary>
3943
/// This is to be able to use the full URL for the endpoint event.
4044
/// </summary>

0 commit comments

Comments
 (0)